Why doesn't $("#RadioButtons:checked").val() work in IE?
Why doesn't $("#RadioButtons:checked").val()
- id selector - work in Internet Explorer but $("input:radio[name='RadioButtons']:checked").val()
- name selector 开发者_如何学编程- does?
<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 more-closely follows the standard with regards to this issue. You can't have two elements with the same ID.
精彩评论