Reputation: 51
I'm building a site in wordpress and need to add a lightbox to a specific link in the menu. I've tried several methods, but can't seem to get them to work. I'm certain it's just a mixup in the way I'm going about it.
In any event, here's a jsFiddle to show my latest attempt.
$("a[href$=login.asp").attr("rel", "lightbox")
Thanks!
Upvotes: 2
Views: 527
Reputation: 1749
Try this updated fiddle: http://jsfiddle.net/aFLLB/9/
Added braces and quotes to
href$='login.asp' aswell
Upvotes: 0
Reputation: 48415
A couple of things wrong:
1) You are not closing your attribute selector brackets (as suggested already)
2) Your href value contains a full stop, because of this you need to wrap the value in quotes too
This is what you want:
$("a[href$='login.asp']").attr("rel", "lightbox")
Upvotes: 5
Reputation: 2307
You're missing a ]
in your jQuery selector. Try $("a[href$=login.asp]").attr("rel", "lightbox")
Upvotes: 1