Checkbox values should not get submitted if they are not checked.
If you want to check with jQuery, I would always use:
var isChecked = $('#checkbox').prop('checked');
Or
var isChecked = $('#checkbox').is(':checked');
With JavaScript, you have to understand the difference between attributes and properties. checked
is both a property and an attribute. However, the attribute checked isn't always updated when the checked
property of a checkbox changes (in some browsers it is). Think of the attribute as the value in the HTML markup parsed by the DOM. The checked
property is an actual member of the checkbox element in the DOM, which always changes based on whether the box is checked or unchecked in the UI.
If you want to try a foolproof method without needed JavaScript, you can try it the "MVC" way, by rendering a hidden input and a checkbox with the same name, each with appropriate "checked"-state values:
<input type="hidden" name="mybox" value="false" />
<input type="checkbox" name="mybox" value="true" />
When you submit the form, if you can't find a mybox
value in the request with a value of "true" then the checkbox was not checked. More about that here.