Element getAttributeNode() Method - Get the value of the target attribute node of an <a> element: - Javascript DOM

Javascript examples for DOM:Element getAttributeNode

Description

Element getAttributeNode() Method - Get the value of the target attribute node of an <a> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
function myFunction() {// ww  w  . ja v  a  2  s  .  co  m
    var elmnt = document.getElementById("myBtn");
    var attr = elmnt.getAttributeNode("onclick").value;
    document.getElementById("demo").innerHTML = attr;
}
</script>

</body>
</html>

Related Tutorials