前几天公司网站设计了jquery库,突然发现有一个页面脚本运行有点异常,原来是因为jquery版本的不同导致

如题如下:

 

<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.5/jquery.js"></script>
<input type="radio" class="rd" checked="checked"  value="0" id="rd1" /><label for="rd1">测试</label>
<script type="text/javascript">
    $(function () {
        alert($(".rd").attr("checked"));
    });
</script>

 

 

 

在jquery1.5版本一下(包含此版本)返回值为:true;

1.5版本以上返回值为:checked;

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2021-11-20
  • 2021-11-21
猜你喜欢
  • 2021-08-05
  • 2021-09-01
  • 2022-01-06
  • 2021-10-05
  • 2021-11-28
相关资源
相似解决方案