I'm trying to write code that displays an alert
when a checkbox is checked but it's not working. I have tried different code online but still can't get it to work. Could anyone please help me. Thank you.
<div id="filterBox">
<input type="checkbox" value="categorya" id="one" />
<label for="one">One </label>
<input type="checkbox" value="categorya" id="two" />
<label for="two">Two </label>
<input type="checkbox" value="categorya" id="three" />
<label for="three">Three </label>
</div>
$(document).ready(function() {
if ($('#one').is(":checked")) {
console.log("testing");
}
});