Open In App

HTML| DOM Ins Object

Improve
Improve
Like Article
Like
Save
Share
Report

The DOM ins Object is used to represent the HTML <ins> element. The ins element is accessed using getElementById().
Properties: 
 

  • cite: It is used to set or return the value of the cite attribute of a inserted element.
  • dateTime: It is used to sets or returns the value of the dateTime attribute of a inserted element.

Syntax: 
 

document.getElementById("ID");

Where “id” is the ID assigned to the “ins” tag.
Example-1: 
 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>DOM ins Object</title>
    <style>
        del {
            color: red;
        }
         
        ins {
            color: green;
        }
         
        h1 {
            color: green;
        }
         
        body {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h2>DOM ins Object</h2>
   
    <p>GeeksforGeeks is a
      <del>mathematical</del>
       
        <!-- Assigning id to 'ins' tag -->
        <ins id="GFG" datetime="2018-11-21T15:55:03Z">
            computer
        </ins>scienceportal</p>
   
    <button onclick="myGeeks()">Submit</button>
    <p id="sudo">
        <script>
            function myGeeks() {
 
                <!-- Return dateTime -->
                var g = document.getElementById("GFG").dateTime;
                document.getElementById("sudo").innerHTML = g;
            }
        </script>
</body>
 
</html>


Output:
Before Clicking On Button : 
 

After Clicking On Button: 
 

Example-2: ins Object can be created by using the document.createElement Method. 
 

html




    <!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM ins Object
    </title>
 
    <style>
        del {
            color: red;
        }
         
        ins {
            color: green;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
 
    <h2>DOM ins Object</h2>
 
    <button onclick="myGeeks()">
        Submit
    </button>
 
    <p id="sudo"></p>
 
    <script>
        function myGeeks() {
            // create 'ins' element.
            var g = document.createElement("INS");
            var f = document.createTextNode("GeeksforGeeks");
            g.appendChild(f);
            document.body.appendChild(g);
        }
    </script>
</body>
 
</html>                  


Output:
Before Clicking On Button : 
 

After Clicking On Button: 
 

Supported Browsers: The browser supported by DOM ins Object are listed below: 
 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

 



Last Updated : 17 Jan, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads