jQuery change Rel of element

A quick snippet on how to change/add a new Rel to an element.

   <script type="text/javascript">
$(document).ready(function() {
$("a").each(function(index) {
    var curRel = $(this).attr("rel");
    if (curRel !== "ignore")
        $(this).attr("rel", curRel + "rel here");

This could be useful in instances where you wish to add say a prettyPhoto del ‘prettyPhoto’ to a set of links that have been generated by a 3rd party script.

About the Author
jQuery change Rel of element jQuery change Rel of element 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g


A highly experienced Web Designer / Web Developer (Webflow, WordPress, Weebly & Custom), Front-end / Back-end Developer & New Media Specialist, with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries, built up over a number of years.