站內搜尋

Thursday, December 12, 2013

[jQuery] 如何取得下拉選單中( select )被選到的項目 ( option ) 的屬性值 (以 title 為例)

$("#my_select").on("change", function(){   alert($(this).find("option:selected").attr("title")); });範例

或是 $("#my_select").on("change", function(){   alert($("option:selected", this).attr("title")); });

No comments:

Post a Comment