开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜