Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])

3k views Asked by At

I have install a fresh wordpress with the DIVI theme.

Wordpress Version: 4.5.2

DIVI Theme Version : 2.6.1

I having this error showing console.

enter image description here

2

There are 2 answers

0
ovicko On

I had the same issue and had to escape quotes like this:
Original code with error.

var activeLink = location.pathname  
$('a[href='+activeLink+']').closest('li').addClass('active'); 

Introduced escaping double quotes

var activeLink = location.pathname  
$('a[href=\"'+activeLink+'\"]').closest('li').addClass('active'); 
0
Mark Leusink On

Although the other answer technically is correct (the syntax used in the selector isn't allowed anymore), the solution isn't to update jquery.js. The selector that is mentioned in the error is used by the Divi theme and the update of Wordpress (that also updated jquery and/or jquery-migrate.js) now disallows it.

The solution is to update your Divi theme. At this moment 2.7.5 is the most recent version. I just updated the theme on my Wordpress site and the problem is gone.