HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p style="font-size:20px;" title="welcome">Hello World</p> <p>Click on the button to display the list of attribute names (in array form) used in the above paragraph.</p> <button onclick="myFunction()">Click Me</button> <p id="point"></p> <script> var x = document.getElementById("point"); var elem = document.getElementsByTagName("p")[0]; function myFunction(){ x.innerHTML = elem.getAttributeNames(); } </script> </body> </html>
OUTPUT
×

Save as Private