Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery 1.5 selector error

Since, upgrading to JQuery 1.5, the following selector no longer works:

var selectedTab = $('div.menu > ul > li > a[href=service.html]');

The error message is:

uncaught exception: Syntax error, unrecognized expression: [href=service.html]

Is this a bug in the latest version of JQuery or (much more likely) a dormant bug in my code?

like image 822
Dónal Avatar asked Apr 08 '26 00:04

Dónal


1 Answers

You need to quote the value:

$('div.menu > ul > li > a[href="service.html"]')
like image 169
SLaks Avatar answered Apr 10 '26 13:04

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!