I have this code [1] for check/uncheck several checkbox elements in a page. It works good on jQuery versions previous to 1.9.1 but for some reason it doesn't on 1.9.1 or newer

Basically, what I do is:

$('.cbx').attr('checked', false);

[1] http://jsfiddle.net/qNPCH/4/

Do you know how can I achieve this with newer versions of jQuery?

Thanks

有帮助吗?

解决方案

Use .prop():

$('.cbx').prop('checked', false);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top