Open In App

HTML DOM isId Property

Improve
Improve
Like Article
Like
Save
Share
Report

The isId Property contains a boolean value that returns a true if the Element has an attribute type of ID, otherwise, it returns a false or undefined value. This Property is used for read-only. 

Syntax: 

attribute.isId 

Return Value: It returns a Boolean value i.e. true if the attribute type is ID, else it returns a false. 

Example: In this example, we will use isId Property.

html




<!DOCTYPE html>
<html>
<head>
    <title>
          DOM isID property
      </title>
</head>
<body>
    <center>
        <h1 style="color:green;">GeeksforGeeks</h1>
        <h2> DOM isId Property</h2>
        <button onclick="geeks()">Submit</button>
        <p id="sudo"></p>
        <script>
            function geeks() {
                let x = document.getElementById("sudo");
                x.innerHTML = x.attributes[0].isId;
            }
        </script>
    </center>
</body>
</html>


Output: 

 

Supported Browser: No major browser support the DOM isID property.


Last Updated : 12 Jun, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads