Solution for jQuery Error: uncaught exception: Syntax error, unrecognized expression: [@href^="http"]

headmaster @ 10:57 pm


JQuery LogoWhile working on a jQuery script for forcing external links to open in a new window I came across the following error:

Error: uncaught exception: Syntax error, unrecognized expression: [@href^="http"]

See the solution below:

Solving The Issue

The solution is simple, if you know your jQuery syntax.

The problem here was that I was using the @ symbol. The @ sign was deprecated since jQuery v1.2 and removed in v1.3. All I had to do was remove @ from the selector:

$("a[href^=http]")

instead of:

$("a[@href^=http]")

That’s all.





Ajax CSS CSS gradients CSS rounded corners CSS Style Sheets CSS Transparency error Failed Evaluations footer header image gallery JavaScript javaScript JavaScript Errors jQuery jquery Lightbox light box links open source PHP PHP PHP scripts Pretty Photo prettyPhoto Programming Languages Script Evaluations Search Engine Optimization StatusNet StatusNet themes templates themes Useful CSS Code Useful WordPress Code Web Applications Web Design Web Development Webmaster Toolbelt WordPress wordpress Word Press WordPress 3.3.2 word press links WordPress Plugins wordpress theme
  • Digital Goodies