Anyone ever seen anything like this before? It’s driving me mad! Basically, I’ve got a checkbox:
<input type='checkbox' id='eventRepeat' />
…and some jQuery, which I’ve now stripped down to:
$('#eventRepeat').click( function() { alert($(this).attr('checked')) })
…but it alerts ‘checked’ whether it is checked or not when I click it! Weird. I’ve checked the DOM to see if there is another rogue eventRepeat; element, but there isn’t, and the HTML validates, give or take a warning or two (no errors)
Other checkboxes on the same page work fine! All ideas welcome!
You could try –
propshould give a truer representation of the state of the checkbox than theattrfunction. See the docs – http://api.jquery.com/prop/