To check a checkbox after clicking a table’s tr element, do the following: $(document).on(“click”,”.your-tr-element”,function(event){ checkbox = $(this).find(“input:checkbox”); if(event.target.type!=”checkbox”){ if($(checkbox).prop(“checked”) == true){ $(checkbox).prop(“checked”,false); }else{ $(checkbox).prop(“checked”,true); } } }); By retaining the event in the callback function, we’re able to ensure the clicked element is not the checkbox itself. This will solve the issue of effectively […]
Tag: checkbox
Check if checkbox is checked with Jquery
To check if an HTML checkbox is checked with JQuery, do the following: if($(“#the-element).is(“:checked”)){ }