Use $.prop() to query checkboxes

$.attr() returns undefined if there isn't an explicit 'checked' attribute on the input. $.prop() is more reliable for jQuery >= 1.6