獲取select的值
"test"
class
="form-control"
name
="code"
>
請選擇option
>
使用型別option
>
前端型別option
>
value
="road_level"
>
車道朝向option
>
value
="lane_direction"
>
道路等級option
>
select
>
//獲取選擇的值$(
'#test').
val();
$('#test option:selected').
val();
//獲取第乙個option的值$(
'#test option:first').
val();
//獲取最後乙個option的值$(
'#test option:last').
val();
//獲取第二個option的值,即索引為1$(
'#test option:eq(1)').
val(
);
jQuery獲取select的值
1.獲取第乙個option的值 test option first val 2.最後乙個option的值 test option last val 3.獲取第二個option的值 test option eq 1 val 4.獲取選中的值 test val test option selected ...
jQuery獲取Select元素
這個表示 假如我們希望當選擇選擇第三類時 如果第四類中有資料則刪除,如果沒有資料第四類的商品中的為預設值。在後面學習了ajax技術後經常會使用到!獲取select 獲取select 選中的 text ddlregtype find option selected text 獲取select選中的 v...
jquery獲取select選中的值
jquery獲取select選中的值 誤區 一直以為jquery獲取select中option被選中的文字值,是這樣寫的 s text 獲取所有option的文字值 實際上應該這樣 s option selected text 獲取選中的option的文字值 獲取select中option的被選中的...