Tag Archives: jquery defining if check box is checked

How to determine if checkbox is checked

// First way 
$('#checkBox').attr('checked'); 

// Second way 
$('#edit-checkbox-id').is(':checked'); 

// Third way for jQuery 1.2
$("input[@type=checkbox][@checked]").each( 
    function() { 
       // Insert code here 
    } 
);
// Third way == UPDATE jQuery 1.3
$("input[type=checkbox][checked]").each( 
    function() { 
       // Insert code here 
    } 
);

// In his comment Andy mentions that the 3rd method
// does not work in Firefox 3.5.2 & jQuery 1.3.2