I have a set of random links, like this:
<a rel="foo"> ... </a>
...
<a> ... </a>
Some of them may have a rel
attribute, some not.
How can add a rel
attribute with a value to each link, and if the link already has one, then append my value to the existing value/values?
Also how can I skip any elements with that have a certain rel attribute, like rel="ignore"
?
Short 'n sweet:
$("a[rel!='ignore']").each(function() {
this.rel += 'theValue';
});