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 therefor开发者_如何学Goe 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!
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;
});
精彩评论