How can I do this : $(".continuar").removeClass("ver");
when I click one checkbox but I click it again to remove the checked?
I mean when I click one checkbox the button next appears and if I click the second checkbox it changes to checked but I want this : when I click the first or second checkbox again to uncheck I want the button to disappear.
This is exactly what I want: check box 1 unchecked = $(".continuar").addClass("ver"); and the same on check box 2 unchecked = $(".continuar").addClass("ver");
I'm talking about this button
<div class='continuar'>
<input type="button" onclick="siguiente()" value="Continuar" class="boton" />
</div>
<input class="opc1" type="checkbox" value="1" onClick="Califica(1)" />
<input class="opc2" type="checkbox" value="2" onClick="Califica(2)" />
function Califica(opc) {
$(".continuar").addClass("ver");
respuestas[pMin]=opc;
if (opc==1) {
$("#p"+pMin+" .respuesta .opciones .opc1").attr('checked', true);
$("#p"+pMin+" .respuesta .opciones .opc2").attr('checked', false);
} else if (opc==2) {
$("#p"+pMin+" .respuesta .opciones .opc1").attr('checked', false);
$("#p"+pMin+" .respuesta .opciones .opc2").attr('checked', true );
} else if(opc == 1 || opc == 2) {
$("#p"+pMin+" .respuesta .opciones .opc1").removeAttr('checked');
$("#p"+pMin+" .respuesta .opciones .opc2").removeAttr('checked');
}
}
I tried to do this with Netzach comment but it didn't work
function Califica(opc){
$(".continuar").addClass("ver");
respuestas[pMin]=opc;
if (opc==1){
$("#p"+pMin+" .respuesta .opciones .opc1").attr('checked', true);
$("#p"+pMin+" .respuesta .opciones .opc2").attr('checked', false);
$('.opc1').on("click",function(){
if($(this).attr('checked')) {
$('.button').show();
}else{
$('.button').hide();
}
});
}else if (opc==2){
$("#p"+pMin+" .respuesta .opciones .opc1").attr('checked', false);
$("#p"+pMin+" .respuesta .opciones .opc2").attr('checked', true );
$('.opc2').on("click",function(){
if($(this).attr('checked')) {
$('#button').hide();
}
});
}
}