[jQuery] How to dynamically add a rel="mylink"?
I understand how to add a class to existing href tags, for example
$("a").addClass("myclass");
I would also like to be able to add a 'rel' attribute to the href
tags, dynamically using jQuery.
For example, my html would have existing:
<a href="somelink">....</a>
The jQuery then adds "myclass" but I also want to add a
rel="myotherlink" too, so I would have a result:
<a href="somelink" class="myclass" rel="myotherlink">...</a>
I would like to avoid directing adding rel="myotherlink" into the html
href tags, if at all possible.
Thanks!