Tuesday, 15 March 2011

jQuery Sytax Error - Unrecognized Expression

A recent upgrade to jQuery 1.5 from 1.2 highlighted a problem with jQuery expressions which resulted in a number of javascript errors...

Syntax error, unrecognized expression: [@attributename=value]' when calling ...

Some digging highlighted that attribute selectors, since jQuery 1.3 and above no longer use the @ syntax. This actually had been deprecated since version 1.1.4, but only from version 1.3 is it no longer supported.

Old way (pre jQuery 1.3)...

$("#holder input[@value=contacts2]");

New way (post jQuery 1.3)...

$("#holder input[value=contacts2]")

No comments:

Post a Comment