• jquery 下拉框值对应的id,赋到前面input中


    html代码:

            <tr>
                    <td>
                        <p class="short-input ue-clear">
                            <label>安监员ID:</label>
                            <input type="text" id="saferid" name="saferid" readonly/>
                        </p>
                    </td>
                    <td>
                        <p class="short-input ue-clear">
                            <label>安监员姓名:</label>
                            <select class="l-select" name="safername" id="safername">
                                <?php echo Ousuclass::all_html_option($saferofferlist,'id', 'fullname') ?>
                            </select>
                            <span><em>*</em></span> //*号标记
                        </p>
                    </td>
               </tr>

    jquery代码

     $("select[name=safername]").change(function(){
                $("input[name=saferid]").val($("select[name=safername]").val());
            })

    后台php代码

    <?php

    public function getSafetyOfficerList()
        {
            $sql = "select * from sysusers where accounttype = '安监员' and isenable = 'Y'";
            $query = $this->db->query($sql);
            return $query->result_array();
        }

    $data['saferofferlist'] =$this->getSafetyOfficerlist()

    ?>

  • 相关阅读:
    「2019纪中集训Day20」解题报告
    PHP基础入门
    javascript
    正则表达式
    DOM 节点
    对象
    字符串
    函数
    for循环
    jQuery
  • 原文地址:https://www.cnblogs.com/lqw4/p/4653855.html
Copyright © 2020-2023  润新知