jQuery change Rel of element

Glenn Blog, Glenn's Blog 0 Comments

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");
});
});
</script>

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

Glenn

A highly experienced WordPress Web Developer, Front-end and 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.

Leave a Reply

Your email address will not be published. Required fields are marked *