Hi all,
I'm frustrated because this does not work:

var pageName = "foobar.html";
var link = $("a[href$=pageName]");
link.addClass('selected');

The problem lies within the fact that it seems the jQuery selector I
use in the second line does not allow variables. It only works with a
hard-coded string (so it seems). So, this does work:

var link = $("a[href$='foobar.html']");
link.addClass('selected');

I must use a variable, though, because (as you might guess), i'm
trying to highlight my navigation link.

How can I make this work with a variable? Is there another technique?

Thanks!

Reply via email to