码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-07-17 13:34:24      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

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()

?>

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

标签:

原文地址:http://www.cnblogs.com/lqw4/p/4653855.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!