Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Element Object</h1>
<h2>The getAttributeNode() Method</h2>
<p>Click the button to display the value of the onclick attribute node of the button element.</p>
<button id="myBtn" onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  var elmnt = document.getElementById("myBtn");
  var attr = elmnt.getAttributeNode("onclick").value;
  document.getElementById("demo").innerHTML = attr;
}
</script>
</body>
</html>