如何在更改时使用jquery获取选择菜单的值 [英] How do I get the value of a select menu with jquery on change
本文介绍了如何在更改时使用jquery获取选择菜单的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个选择菜单,我试图绑定一个单击功能,并且能够在更改时重新获得选择选项的value属性.
I have a select menu that i'm trying to bind a click function and be able to get the select options value attribute back on change.
select = $('#select_networks').selectmenu();
//bind the change of network/group
select.bind( "change", function(event, ui) {
//need to figure out the selected elements value attribute
});
推荐答案
查看此内容:
$("#select_networks").bind("change", function() {
alert($(this).val());
});
更新
$("#select_networks").bind("change", function() {
var typeVal = $(this).children("*[value=" + $(this).val() + "]").attr("type");
alert(typeVal);
});
这篇关于如何在更改时使用jquery获取选择菜单的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文