JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" />
<a href="#">Change CheckBox</a>
JavaScript
$(function() {
$("a").click(function() {
if ($("input[type='checkbox']").attr('checked') == "checked"){
$("input[type='checkbox']").removeAttr('checked');
$("input[type='checkbox']").trigger('change');
}else{
$("input[type='checkbox']").attr('checked', 'checked');
$("input[type='checkbox']").trigger('change');
}
return false;
});
$("input[type='checkbox']").change(function(){
console.log("Checkbox changed.");
alert('checkbox changed test');
});
});