Anchor target Property - Return the value of the target attribute of a link: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Anchor

Description

Anchor target Property - Return the value of the target attribute of a link:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//from   w w w  . ja v a 2s.com
    var v = document.getElementById("myAnchor").target;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials