Javascript examples for jQuery:Form Checkbox
Get state of checkbox using javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> $(function(){/*from www .java 2s. co m*/ (function ($) { "use strict"; $(document).ready(function () { $('#edit-toggle-me').click(function(){ console.log( this.checked ? ":)" : ":(" ); }); }); })(jQuery); }); </script> </head> <body> <input type="checkbox" id="edit-toggle-me"> </body> </html>