【发布时间】:2011-02-22 17:24:42
【问题描述】:
我正在尝试使用 jQuery 根据所选选项发出 ajax 请求。
有没有一种简单的方法可以使用 jQuery 检索选定的选项 id(例如“id2”)?
<select id="my_select">
<option value="o1" id="id1">Option1</option>
<option value="o2" id="id2">Option2</option>
</select>
$("#my_select").change(function() {
//do something with the id of the selected option
});
【问题讨论】:
标签: jquery dom jquery-selectors