I have three checkboxes and I'm trying to implement "All" and "None".
<div class="controls col-md-5">
<input id="None" name="None" type="checkbox" value="true" /><input name="None" type="hidden" value="false" />
<label for="None">None</label>
</div>
The internet says to check and set the 'checked' property, just like you would expect.
if ($('#None').checked) {
$('#cBox').checked = false;
}
But it doesn't work.
Checking the console, I can see that $('#None').checked is returning 'undefined'.
$('#None').attr('checked) should also work but also returns 'undefined'.
$('#None') is working. I can expand it and see the 'checked' prop is updating as I check and uncheck the box.
UPDATE
$('#None').is(':checked') works!
$('#None').attr(':checked') is still undefined.
Now I just need to set 'checked' on the three boxes, but nothing works.
$('#None').attr('checked')=true fails with 'you can't assign to a function call.'
$('#None').checked=true doesn't fail, but doesn't change anything.