How to remove checked attr on a checkbox when I click it again
This question already has an answer here:
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 »</button>
链接地址: http://www.djcxy.com/p/12264.html
上一篇: 堆栈溢出