Anchor type Property - Set the type attribute of a link to text/html: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Anchor

Description

Anchor type Property - Set the type attribute of a link to text/html:

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 type attribute of the link above to "text/html"</button>

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

<script>
function myFunction() {/*from   w  ww. j a va 2s  .c  om*/
    document.getElementById("myAnchor").type = "text/html";
    document.getElementById("demo").innerHTML = "The value of the type attribute of the link above is now 'text/html'.";
}
</script>

</body>
</html>

Related Tutorials