我正在尝试使用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
});
https://stackoverflow.com/questions/2888446
复制相似问题