How to check if checkbox is checked using jQuery


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // First way
  2. $('#checkBox').attr('checked');
  3.  
  4. // Second way
  5. $('#edit-checkbox-id').is(':checked');
  6.  
  7. // Third way for jQuery 1.2
  8. $("input[@type=checkbox][@checked]").each(
  9. function() {
  10. // Insert code here
  11. }
  12. );
  13. // Third way == UPDATE jQuery 1.3
  14. $("input[type=checkbox][checked]").each(
  15. function() {
  16. // Insert code here
  17. }
  18. );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.