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


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

编程 jquery Select Text Value

214215 10 years, 8 months ago

获取select选中的 value:

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

获取select 选中的 text :

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

获取select选中的索引:

$("#example_select").get(0).selectedindex;
坚强的土豆 answered 10 years, 7 months ago

Your Answer