Lets say I have the following:
$('input[rel]').jOverlay({ overlayId: "#overlayID" });
How can I dynamically get the overlayID from the rel value of the input? I have tried using:
$('input[rel]').jOverlay({ overlayId: this.attr('rel') });
And I have tried wrapping it in an anonymous function:
$('input[rel]').jOverlay({ (function() { overlayId: this.attr('rel'); }) });
To no avail, what is the right way to do this?
Many Thanks
– Jai
You’d have to iterate over them using
each(), otherwisethis(in your first and second examples) is actually thewindowand not the element (also,thiswouldn’t make sense if you had multiple elements matched).The reason the third won’t work is most likely the plugin you’re using doesn’t support that parameter list.