Question

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!

Was it helpful?

Solution

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")

Here is a working example

OTHER TIPS

You're missing a ] in your jQuery selector. Try $("a[href$=login.asp]").attr("rel", "lightbox")

Try this updated fiddle: http://jsfiddle.net/aFLLB/9/

Added braces and quotes to

href$='login.asp' aswell
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top