获得select下拉框的值

时间:2024-06-12 19:04:50

html

--------------------------------------------------------------------------------------

<select id="num">
<option value="0">请选择</option>
<option value="1">111</option>
<option value="2">222</option>
<option value="3">333</option>
<option value="4">444</option>
</select>

jQuery

--------------------------------------------------------------------------------------

方法1:

var val = $('#num').val();

方法2:

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