为什么 $("#RadioButtons:checked").val()
- id 选择器 - 在 Internet Explorer 中不起作用,但 $("input:radio[name='RadioButtons ']:checked").val()
- 名称选择器 - 是吗?
<input name="RadioButtons" id="RadioButtons" type="radio" value="1" checked>
<input name="RadioButtons" id="RadioButtons" type="radio" value="2">
<script>
alert($("#RadioButtons:checked").val());
alert($("input:radio[name='RadioButtons']:checked").val());
</script>
最佳答案
IE 在这个问题上更严格地遵循标准。两个元素不能具有相同的 ID。
关于jquery - 为什么 $ ("#RadioButtons:checked").val() 在 IE 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2924396/