jquery button to uncheck checkboxes

This question already has an answer here:

  • Setting “checked” for a checkbox with jQuery? 38 answers

  • 'checked' property is boolean but it means when it not exists it is false. If you need not submit on click or don't go to link there is e.preventDefault() . So you need this:

     $('#remove-button').click(function(e) {
        $('input:checked').removeAttr('checked');
        e.preventDefault();
     });
     $('#add-button').click(function(e) {
       var input = $('input.input-to-check')
       input.attr('checked', 'checked');
       e.preventDefault();
     });
    
    链接地址: http://www.djcxy.com/p/12258.html

    上一篇: 使用Jquery检查/取消选中输入框

    下一篇: jquery按钮取消选中复选框