Syntax error, unrecognized expression for href

You need to enclose special characters in quotes when using a attribute based selector.

if ($('ul li a[href=""https://stackoverflow.com/questions/31197452/+ id +""]').length) {

Your version of selector would result

if ($("ul li a[href=#!...]").length) {

The #! will throw unrecognized expression.


My version where the "" escape the characters

if ($('ul li a[href="#!..."]').length) {

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)