What is the proper way to uncheck a checkbox in jQuery 1.7?

前端 未结 4 1691
轮回少年
轮回少年 2021-01-05 14:30

I\'m upgrading from jQuery 1.5.1 -- I\'ve read about the \"new\" way to \"check\" checkboxes (in 1.6) using

prop(\"checked\", true);

But w

4条回答
  •  执笔经年
    2021-01-05 15:18

    $('#someSelector').removeAttr('checked');
    

    Remove the checked attribute and you should be good to go.

    More info about prop vs attr here. They also mention the checked attribute and call it out specifically as an attribute, not a property.

    http://api.jquery.com/prop/

提交回复
热议问题