Javascript examples for DOM:Element getAttributeNode
Element getAttributeNode() Method - Get the value of the target attribute node of an <a> element:
<!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>