views:

1234

answers:

3

I am using jquery to locate all the checkboxes in a table column that are checked. For that purpose I am using the following code:

        $("input[type=checkbox][checked]").each(function() {

             //Do Stuff

        });

This works fine in Firefox 3 but does not work in IE8 or Safari. Can anyone explain why and/or provide a workaround?

EDIT: I'm using jQuery v1.3.2

+7  A: 

try $("input[type=checkbox]:checked").each...

Edit or even sweeter: $("input:checkbox:checked").each...

That works for me in IE8.

peirix
Fixed your answer, :checkbox alone is not recommended...
Paolo Bergantino
thank you, good sir (:
peirix
+1  A: 

Try this

 $("input:checked").click(function(){
   alert('abc');    
      }) ;
Alexander Corotchi
+1  A: 

A workaround:

$("input:checked").each(function() {
    //Do Stuff
});
Darin Dimitrov
this would hit radio buttons as well, though...
peirix