You can I get a checkbox’s value in jQuery like this if you have set a class or id for it
$('#checkbox_id').val(); $('.checkbox_class').val();
Without id
$("input[type='checkbox']").val();
For some reason:
•$(‘#checkbox’).val() always returns on
•$(‘#checkbox’).is(‘checked’) always returns false
But,
$('#checkbox').prop('checked')
Returns the right checkbox state.
Other way of retrieving checkbox’s value is
if ( elem.checked ) if ( $( elem ).prop( "checked" ) ) if ( $( elem ).is( ":checked" ) )
What do you think?