To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method.

根据官方的建议:具有 true 和 false 两个属性的属性,如 checked, selected 或者 disabled 使用prop(),其他的使用 attr()。

 

参考链接

http://www.cnblogs.com/zhwl/p/3520162.html

http://blog.sina.com.cn/s/blog_655388ed01017cnc.html

http://www.cnblogs.com/Showshare/p/different-between-attr-and-prop.html

1 对 “jQuery attr()和prop()的区别”的想法;

发表评论

邮箱地址不会被公开。 必填项已用*标注