jQuery中如何获取Select选中的Text和Value?


想用jquery做一个ajax的请求,但是表单中有Select tag,那么jquery如何得到选定的Text和Value呢?

编程 jquery Select Text Value

214215 12 years, 1 month ago

获取select选中的 value:

$("#example_select").val();

获取select 选中的 text :

$("#example_select").find("option:selected").text();

获取select选中的索引:

$("#example_select").get(0).selectedindex;
坚强的土豆 answered 12 years ago

Your Answer