Q:

jquery checkbox val() always return on

Hi after a lot of search I got a method to check my checkbox. But I dont know what is the problem. Its val() always return on. This is happening when I check it and also when I uncheck it. I suppose it should return null when unchecked. Help
$(document).ready(function(){
$('#ch').change(function(){
    alert($(this).val());
});
 });

and the html
<input type="checkbox"  id="ch"/> Check it out...

A:

You have set of option to check if your checkbox is checked or unchecked,
alert($(this).is(":checked")); ////return true if checked

Or
alert(this.checked); //return true if checked

Or
<input type="checkbox" id="ch" checked/>
alert($(#ch).attr( "checked")); //return checked if checked 

Or
alert($(this).prop( "checked")); //return true if checked

A:

I think what you are looking for is whether it is checked or not for that you can check checked status
alert(this.checked); // or $(this).is(':checked')

Demo: Fiddle

