开发者

Removing a checked property [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

In the jQuery documentation, it says

Do not use removeProp to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element. Use .prop() to set these properties to false instead.

Q: Instead of:

$('input:checkbox').not(this).removeAttr('checked');

I should I now us开发者_运维技巧e:

$('input:checkbox').not(this).prop('checked',false);


Use

$('input:checkbox').not(this).attr('checked', false);

See this example: http://jsfiddle.net/7586a/

Update: Seems like I didn't get the news about jQuery 1.6's .prop(). Looks like your code is right.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜