easyui combobox 类选择器多个下拉框使用一个接口回显数据
HTML:
当使用如下选择器来操作combobox对象时,会出现不同的表现。
JavaScript:
$(‘input[name=myinputdom]’).combobox(…);//错误
$(’:input[name=myinputdom]’).combobox(…);//错误
$(’#myinputdom’).combobox(…);//正确
$(’.myinputdom’).combobox(…);//正确
分析:
使用firefox查看最终的页面代码如下:
<!-- 使用id和class选择器选中的是该元素,因为该元素属于easyui-combobox类型,所有可以使用combobox的方法 --!>
class="textbox-value"type="hidden"name="myinputdom"value="3 hours">==所以,我们可以使用ID和类选择器去编辑easyui组件,不可以用input[name=‘myinputdom’]。一般来说,单个组件我们可以使用ID选择器,批量编辑我们可以使用类选择器。