select下拉框选中其中一个值】的更多相关文章

function LoadList123() { var param = { action: "SelectShopType1"};//参数拼接 var Resultstr = ""; var PagerStr = ""; $.ajax({ type: "Post", async: true, cache: false, url: "/ashx/ZWY/ZWY.ashx", data: param, dat…
现在有一id=test的下拉框,怎么拿到选中的那个值呢? 分别使用javascript原生的方法和jquery方法 <select id="test"  name="">     <option   value="1">text1</option>     <option   value="2">text2</option>    </select> co…
有一id=test的下拉框,怎么获取选中的那个值呢? 分别使用javascript方法和jquery方法 <select id="test"  name="">     <option   value="1">text1</option>     <option   value="2">text2</option>    </select> 一:javas…
html: <select id="lib_select"  name="">   <option   value="1">text1</option>     <option   value="2">text2</option>   </select> <input type="checkbox" value="1&q…
代码: var form = layui.form, layer = layui.layer; // 监听 $(document).ready(function() { // select下拉框选中触发事件 form.on("select", function(data){ alert(data.value); // 获取选中的值 }); });…
群里有个帅哥问了这么个问题,他的下拉框刚进页面时是隐藏起来的,但是是有值的,为啥呢?因为下拉框默认选中了第一个值呗,,, 所以提交数据的时候就尴尬啦,明明没有选,但是还是有值滴.怎么办呢? 一开始看到的时候不是很理解他的意思,提交的时候判断一下把获取选中的值赋值为空不就好啦.难道还有什么深意? 不过这样是不是有点麻烦或者有点太low啊,想着的时候,群里的大神来了一句设置属性disabled=true就可以了. 许久不看jq,许久没用下拉框,连长什么样子都记不清楚了,哪里敢乱说误人子弟,看到大神这…
//JS<script type="text/javascript> //ajax动态给添加原料的[商品名称]下拉框绑定selected属性 $("#origin_code").find("option").each(function(index,dom){ if($(this).val() == msg.data.origin_code){ $(this).attr("selected","selected&qu…
js代码: var mySelect = document.getElementById("resultList2"); var mySelectText = mySelect.options[mySelect.selectedIndex].text; html代码: <select id="resultList2" disabled="disabled"> <option>1</option> <opt…
每一次操作select的时候,总是要出来翻一下资料,不如自己总结一下,以后就翻这里了. 比如<select class="selector"></select> 1.设置value为pxx的项选中 $(".selector").val("pxx"); 2.设置text为pxx的项选中 $(".selector").find("option[text='pxx']").attr(&qu…
<select onchange="window.location=this.value;"><option value="a.html">用户管理</option><option value="b.html">用户</option></select>注意onchange部分,这样即可以实现跳转了…