Hi,
My (vary basic) knowledge of Javascript tells me this should be fairly easy to do, but there's one bit I'm not sure of.
I have a series of divs on a page with class "product-image" - I want all the links within each div to have the same rel, but the rel for each div should be unique.
I know this would work, generally, if I wanted to add the same rel attribute to every link:
Code:
<script type="text/javascript">
$(document).ready(function() {
$('div.product-image a').each(function() {
$(this).attr('rel','lightbox');
});
});
</script>
... but how do I make it add a different, unique rel within each different div.product-image?
It doesn't particularly matter what the rel is as long as it is unique, it could just be a random string. The reason I need this to happen automatically, rather than manually, is because the site will be managed by the user through a CMS, so I need to automatically attach the right functions.