|
How to check and uncheck a checkbox with jQuery and how do I know if a checkbox is checked ? |
|
to check/uncheck:
to know if the checkbox is checked:
|
|
For live Demo click this below link: http://jsfiddle.net/nanoquantumtech/FgGxg/ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $('#btnSubmit').click(function () { var checkBoxCheckedCount = $('#MyFormID').find('[type="checkbox"]:checked').length; $('#Result').html(checkBoxCheckedCount > 0 ? checkBoxCheckedCount + ' Check Box Is Checked' : 'All Check Box Is UnChecked'); }); }); </script> </head> <body>
<input type="checkbox"/>Car
<input type="button" id="btnSubmit" value="Submit"/>
</body>
</html>
<input type="checkbox"/>Van <input type="checkbox"/>Bus http://jsfiddle.net/nanoquantumtech/FgGxg/
(Apr 18 at 06:03)
ThulasiRam
|


