checkbox val not showing false


checkbox val not showing false



I have the follwoing code:

 $("input:checkbox").live('click', function() {                           alert($(this).val()); }); 

True is shown if the checkbox is checked. However, if the checkbox is checked and I uncheck it, the value shown is still true. How can I correct that? What is wrong with the code? Thanks


patterns to use when building complex web UI

1:

Validation not firing even when my form is obviously invalid
The value of a checkbox is always the same. asp.net mvc datannotation password validateYou need to see if it is checked or not.. ASP.NET MVC - How controls retain their state
….attr('checked'); 
JavaScript url auto-resolution in Asp.Net MVCHow Testing relates to ASP.NET MVC/WEBFORMS Silverlight MVVM

2:

Why am I getting “The directive 'control' is unknown” error in ASP.NET MVC?
this.checked //true/false - not jquery $(element).checked //does not job $(element).attr('checked') //checked/NULL * $(element).is(':checked') //true/false 
*note this <input TYPE=CHECKBOX CHECKED=CHECKED> returns in both checked/unchecked state checked. 404s for asp.net mvc solution doesn't work in production


94 out of 100 based on 69 user ratings 1044 reviews