I am trying to check if the box is checked or not with jquery. It doesn't work but I don't get why.
If I refresh the page and keep the checkbox check, then it will echo alert.
if($("#faith").is(':checked')){
alert('hello');
}
if($("#diet").is(':checked')){
alert('hello');
}
<input type="checkbox" name="cureway" id="faith" value="faith" /><label for="faith">My faith</label>
<input type="checkbox" name="cureway" id="diet" value="diet" /><label for="diet">My diet</label>
<input type="checkbox" name="cureway" id="exer" value="exer" /><label for="exer">My excercise</label>