Hi how to add if checkbox is check in input value true and when checkbox is uncheck false?
I try like this but it dosen't work:
$('#analytics').change(function(){
if($("#analytics").prop('checked')){
$("#analytics").val('true');
console.log(analytics);
}else{
$("#analytics").val('false');
console.log(analytics);
}
});
Aucun commentaire:
Enregistrer un commentaire