Unrecognized expression :: [type = checkbox] with jQuery 1.8

I am updating the code to jQuery 1.8 and I am starting to get this error:

unrecognized expression: :[type=checkbox] 

Of course, this suggests that the expression :[type=checkbox] not recognized by the new version of jQuery, and my question is:

Do I have the wrong path, or is it a mistake ?

I made this version for the jsFiddle test http://jsfiddle.net/4y8tb/6/ , open the console to see the log, and if you change the jQuery version you see that it works and the other does not.

I tried a different syntax (for example :[type="checkbox"] ) but could not.

+4
source share
2 answers

Change this:

 $('input:[type=checkbox]') 

To:

 $('input[type=checkbox]') 

You are using Attribute Equals , the syntax should be:

 $('element[attribute="value"]') 
+9
source

jQuery has its own pseudo selector for flags:

 $(':checkbox') 
+5
source

All Articles