Anchor rel Property - Set the value of the rel attribute to "nofollow": - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Anchor

Description

Anchor rel Property - Set the value of the rel attribute to "nofollow":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p><a id="myAnchor" href="https://www.java2s.com">java2s.com</a></p>

<button onclick="myFunction()">set the value of the rel attribute of the link above to "nofollow"</button>

<p id="demo"></p>

<script>
function myFunction() {//from   w  ww.j  ava  2s . c  o m
    document.getElementById("myAnchor").rel = "nofollow";
    document.getElementById("demo").innerHTML = "The value of the rel attribute of the link above is now 'nofollow'.";
}
</script>

</body>
</html>

Related Tutorials