Syntax error, unrecognized expression:

Posted on: October 6th, 2014

Best thing to do when you see this is check what expression is unrecognized. For me it was a[href=]. After looking into the WordPress theme files it turned out that for some unknown reason the theme developers had not included quotes around the actual href. So what should have been:

$('a[href*="#"]').bind("click", function(e){
// or
$('header').find('a[href="'+window.location.hash+'"]');

// was instead

$('a[href*=#]').bind("click", function(e){
// and 
$('header').find('a[href='+window.location.hash+']');

// no need for "" trolololololololol

It was also one of those developer miracles where you try something and it works the first time, which makes you question whether there was ever a problem to begin with. It is October after all. This is the time of the year where spooky code bugs pop up and disappear just to mess with developers. No? Hasn’t happened to you? Just wait. The <poltergeists> are out there.

Links that helped:

spoopy

previous post: Getting Rid of Website Builder on GoDaddy next post: Sublime Text – CTags Package Errors