JQuery selector problem - 'Syntax error, unrecognized expression' fix
I just spent a little time wrestling with an annoying JQuery error when trying to select a form element by name.
I was using the following code to simply grab the contents of a hidden field named 'required':
I got this syntax from a quick google search and found it referenced on a number of web guides about JQuery.
However, when I used it I got the following error in Firefox:
Well after some head scratching and then some more searching I found the answer. The @ syntax is no longer supported in JQuery 1.3+.
So the simple fix is to just remove the @ and it'll work as expected:
Hopefully this will help someone who, like me, hit's Google when looking for a quick fix to a problem.. :)



Thanks for your comment and glad you were able to find the answer to this issue quickly. I like being able to hit Google when I get an error and get the answer straight away. No hassle and then we can get right back to the creative part of our job. :)
Thanks too. But, we have to change 493 errors regarding '@'. Are you sure, there's nothing will happen?
The @name syntax is certainly not supported anymore so replacing '@name' for 'name' should do the trick.
My advise is to first take a full copy of the site and then do the global search and replace. Test the site and if there are any problems roll back. Do it locally first if you can.
Thanks!
~Doug
Excellent. Glad to know it was able to help you out quickly. Nothing better than finding the answer to a creativity destroying problem at the number slot on good old Google.
Thanks for taking the time to comment.
Nice to know this is helping people. The quicker this kind of problem is solved the better in this game.
Hey no probs - glad I could help. Thanks for posting.
http://docs.jquery.com/Selectors
Still, seems like they should have a breaking change like that in blinking red all over their site =)
the first search Result in search Engine show me this Answer :)