js简单的下拉选择器

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_30299243/article/details/82191585

(1)布局文件

<p class="main1_list">

                    <label>是否支持医保:</label>

                    <select name="ddlroom" class="selcet-input w48" id="medicalIns">

                        <option id="1" value="1">否</option>

                        <option id="0" value="0">是</option>

                    </select>

                </p>

扫描二维码关注公众号,回复: 3033545 查看本文章

<select id="chooseorder">

  <option value="A" url="0">订单生成时间</option>

  <option value="B" url="1">订单更新时间</option>

</select>

var index = myselect.selectedIndex; // selectedIndex代表的是你所选中项的index

alert(myselect.options[index].getAttribute('url') + "ererer")var index = myselect.selectedIndex; // selectedIndex代表的是你所选中项的index

alert(myselect.options[index].getAttribute('url') + "ererer")

(2)动态更改状态

if(details_shuju.medicalIns != null) {

                if(details_shuju.medicalIns == 1){

                    $("#medicalIns").val(0);

                }

                $("#medicalIns").val(1);

            }

猜你喜欢

转载自blog.csdn.net/qq_30299243/article/details/82191585
今日推荐