Quantcast
Viewing all articles
Browse latest Browse all 20

Unrecognized Expression Error in jQuery 1.8 and above when using :radio, :checkbox, etc…

I upgraded a project recently from 1.7.2 of jQuery to 1.8.2 and began testing my pages.  On one of my pages I was getting the following error:

Image may be NSFW.
Clik here to view.
unrecognized expression

Doing a little research I discovered that in the 1.8 release of jQuery they deprecated the :radio and other such pseudo-class selectors.  The preferred method moving forward is to use the equivalent CSS selector of [type=radio].

Here’s the jQuery 1.8 release notes and the ticket describing this change.

Why the removal?

From their radio selector page under the Additional Notes section:

Because :radio is a jQuery extension and not part of the CSS specification, queries using :radio cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. For better performance in modern browsers, use [type="radio"] instead.

And from the ticket page:

Deprecate (for eventual removal) the input type selectors: :file :image :password :radio :reset :submit :text -- They are basically aliases to [type="file"] [type="image"] but can't use querySelectorAll - I think having these selectors around in the long term future is entirely unnecessary and confusing.

Happy Coding! Image may be NSFW.
Clik here to view.
Smile

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 20

Trending Articles