2010-08-16 53 views

回答

0

試試這個:

var itemLevel = $('select[title="Item Level"] option:selected').val(); 

或基於名稱:

var itemLevel = $('select[name*="DropDownChoice"] option:selected').val(); 

*=手段得到它的名字裏有DropDownChoice地方選擇框。

如果你想選擇的選項的text而是使用的text()代替val()如:

var itemLevel = $('select[name*="DropDownChoice"] option:selected').text(); 

更新:

你可以這樣做:

$('Select[title="Item Level"'].change(function(){ 
    alert($('option:selected', $(this)).text()); 
}); 
+0

對不起Sarfraz我剛剛更新了這個問題。 – Peter 2010-08-16 00:29:23

相關問題