views:

625

answers:

2

Hey there, having some issues passing parameter values in jQuery. I need a div to open a link that opens as a Shadowbox dialog .. (Shadowbox uses the rel tag) i therefore need to get the value of both the href and rel, but cant' figure it out. i tried to just add .attr("rel") to the string but that didnt work.

My jquery:

$("div.banner").click(function() {  
     window.location = $(this).find("a").attr("href"); return false;     }); 

thank you!

+3  A: 

I'm not entirely sure what you're after, but if you wanted to use both the rel and href attributes when building the window.location string, you'd need to do something like this.

$("div.banner").click(function() {
    var $link = $(this).find("a");
    window.location = $link.attr("href") + $link.attr("rel");
    return false;
});
BBonifield
Thank you! Something tells me its going to work out :)
Clare
A: 

... this works in that it brings whatever is the ref field into the URL string after the href. Unfortunately, shadowbox doesnt work that way, so i think i have to find an alternate method to do it. Anyway appreciate your response.

Clare