ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

I need to make a toogel check box but i have tried them but i could run them can any one suggest me to have this


#1
function checktoogel() {

$(’#chk1’).checked;
this.$(’#chk2’).checked;
}

in this i have two checkbox 1 is chk1 and other is chk2 i need these to be toogel at the same


#2

sorry guys i have done with this

$(’#chk1’).click(function() {
if ($(this).is(’:checked’)) {
$(’#chk2’).prop(‘checked’, true);
} else {
$(’#chk2’).prop(‘checked’, false);
}
});

$(’#chk2’).change(function(){
var a = $(‘chk2);
if(a.length == a.filter(":checked").length){
$(’#chk1’).prop(‘checked’, true);
}
else {
$(’#chk1’).prop(‘checked’, false);
}
});