unrecognized expression: :[type=checkbox] with jQuery 1.8
Asked Answered
C

2

5

I update the code to jQuery 1.8 and I start getting this error:

unrecognized expression: :[type=checkbox]

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

I have type it the wrong way, or it's a bug ?

I have make this version for test on jsFiddle http://jsfiddle.net/4y8tb/6/ , open the console to see the log, and if you change the jQuery version you see it one to work and one not.

I have try some other syntax (like :[type="checkbox"]) but fails.

Cotquean answered 13/8, 2012 at 10:13 Comment(0)
A
10

Change this:

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

To:

$('input[type=checkbox]')

You are using Attribute Equals selector, the syntax should be:

$('element[attribute="value"]')
Accumulative answered 13/8, 2012 at 10:16 Comment(1)
+1 Thank you, this is the one. (and Andy is work, but this is close to my code).Cotquean
N
6

jQuery has an own pseudoselector for checkboxes:

$(':checkbox')
Nevsa answered 13/8, 2012 at 10:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.