2010-08-16 55 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

相关问题