Posted By

cesar on 08/21/09


Tagged

javascript jquery checkbox


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

luman
rickfu


How to check if checkbox is checked using jQuery


 / Published in: jQuery
 

  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  

You need to login to post a comment.