Javascript examples for DOM:Attribute
The isId property returns true if the attribute is of type ID, otherwise it returns false.
This property is read-only.
A Boolean, returns true if the attribute is of type ID, otherwise false
The following code shows how to Find out if an attribute is the element's ID attribute or not:
<!DOCTYPE html> <html> <body> <p id="demo">P element</p> <button onclick="myFunction()">Test</button> <script> function myFunction() {// www. ja v a2 s .c o m var x = document.getElementById("demo"); x.innerHTML = x.attributes[0].isId; } </script> </body> </html>