<html>
<body>
<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>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_getattributenode2 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:02:18 GMT -->
</html>