jQuery问题:知道<select>的ID,怎么获取<option>的属性值?

$("#selroom").change(function () { alert($("#selroom option[selected]").attr("status")); });
这样为什么alert()弹出了5次?
我真么才能得到当前选择的那个<option>标签的属性值呢?
----急---急----急-----急-------------------------------




守候你守候我
浏览 1132回答 3
3回答

千万里不及你

$("#selroom").change(function () {alert($("#selroom option:selected").attr("status"));});

一只斗牛犬

123$("#ID").find("option").each(function(n,i){alert($(i).val());});

牧羊人nacy

$("#select的id").val()或者$("#select的id>option:selected").val()
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Ruby