Javascript examples for DOM:Element hasAttributes
The hasAttributes() method returns true if it has any attributes, otherwise false.
If the node is not an Element node, the return value is false.
None
A Boolean, returns true if the node has attributes, otherwise false
The following code shows how to Find out if the <body> element has any attributes:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . java 2 s . c o m*/ var x = document.body.hasAttributes(); document.getElementById("demo").innerHTML = x; } </script> </body> </html>