Thursday, 28 July 2011

jQuery Saves From Curious Checkbox Behaviour

I have a ASP.Net form containing a repeater with multiple inputs on the page, mostly radio buttons and checkboxes.

The Input controls are added to the page dynmically as Server Controls within a custom Repeater Template during the Repeater DataBind event...


Basically the 'checked' attribute doesn't exist.

So this doesn't return whether the checkbox is checked: var checked = this.getAttribute("checked");

But this will: var checked = $(this).attr('checked');

No comments:

Post a Comment