`

jQuery取值大全

阅读更多

获取下拉列表的值:

 

<select id="status"  style="width: 188">
          <option value="-1" selected="selected">===请选择===</option>
          <option value="0">正常</option>
          <option value="1">注销</option>
</select>

 

var status = $('#status').children('option:selected').val();

 

<select id="department" style="width: 188">
          <option selected="selected" val="">===请选择===</option>
</select>

 

把数据库的值读到下拉列表中:

//查询部门下拉列表的值
   $('#department ').combobox({
      url:'<%=path%>/admin/department/UPNAME.dox',

      valueField:'UPID',
      textField:'UPNAME',
      listHeight: 12
   });

 

在本页面中用jQuery获得选中的值:

var department = $('#department ').combobox('getValue');

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics