How to remove checked attr on a checkbox when I click it again

This question already has an answer here:

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

  • If you click an input, you need know if is checked or not. Your button init $('#button').hide(); or display:none.

    <div id="button" style="display:none;">YOUR BUTTON</div>
    
    <input class="opc1" type="checkbox" value="1" />
    <input class="opc2" type="checkbox" value="2" />
    
    $('.opc1').on("click",function(){
      if($(this).prop('checked')) {
        $('#button').show();
      }else{
       $('#button').show();
      }
    });
    $('.opc2').on("click",function(){
      if($(this).prop('checked')) {
        $('#button').hide();
        //Also you can use $('#button').remove(); but if you need show this before don't remove.
      }
    });
    

    我不确定你是什么意思,但如果我明白你正确的你寻找这样的东西:

    button{
      display:none;
    }
    input:checked + input:checked + button{
      display:block !important;
    }
    Please accept the terms of Conditions<input type="checkbox">
    and the License Agreement<input type="checkbox">, thanks!
    <button>Thanks, proceed &raquo;</button>
    链接地址: http://www.djcxy.com/p/12264.html

    上一篇: 堆栈溢出

    下一篇: 当我再次单击它时,如何在复选框中删除选中的attr