HTML | DOM ins cite Property

The DOM ins cite Property is used to set or return the value of the cite attribute of an Element. The cite attribute is used to specify the URL of the document or message which denotes the reason of deleting the text. It has no visual effect on any ordinary Web Browser. It can only be used by screen readers.

Syntax:

  • It is used to return the cite property.
    insObject.cite
  • It is used to set the cite property.
    insObject.cite = URL
  • Property Vaues:



    • URL: It specifies the URL of the document that defines why the text was inserted by deleting other previous text.

    Possible values are:

    1. Absolute URL: It is used to point out other websites (like cite =”http://www.geeksforgeeks.org”)
    2. Relative URL: It is used to point out the page within the website. (like cite=”geeks.htm”)



    Return Value: It returns a string value which represents the URL of the Document.

    Example-1: This example illustrates that how to return the cite Property.

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <title>DOM ins cite Property</title>
        <style>
            del {
                color: red;
            }
              
            ins {
                color: green;
            }
              
            h1 {
                color: green;
            }
              
            body {
                text-align: center;
            }
        </style>
    </head>
      
    <body>
        <h1>GeeksforGeeks</h1>
        <h2>DOM ins cite Property</h2>
      
        <p>GeeksforGeeks is a
            <del>mathematical</del>
      
            <!-- Assigning id to 'ins' tag -->
            <ins id="GFG" 
                 cite="www.GeeeksForGeeks.com"
                computer 
            </ins>scienceportal</p>
      
        <button onclick="myGeeks()">
          Submit
      </button>  
      <p id="sudo">
        <script>
          function myGeeks() {
            // Return value of cite attribute.
             var g = document.getElementById(
               "GFG").cite;
              document.getElementById(
                "sudo").innerHTML = g;
            }
            </script>
    </body>
      
    </html>

    chevron_right

    
    

    Output :
    Before Clicking On Button:

    After Clicking On Button:

    Example-2: This example illustrates that how to set the cite Property.

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <title>
          DOM ins cite Property
      </title>
        <style>
            del {
                color: red;
            }
              
            ins {
                color: green;
            }
              
            h1 {
                color: green;
            }
              
            body {
                text-align: center;
            }
        </style>
    </head>
      
    <body>
        <h1>GeeksforGeeks
      </h1>
        <h2>DOM ins cite Property
      </h2>
      
        <p>GeeksforGeeks is a
            <del>mathematical</del>
      
            <!-- Assigning id to 'ins' tag -->
            <ins id="GFG" 
                 cite="www.finecomb.com"
                computer 
            </ins>scienceportal</p>
      
        <button onclick="myGeeks()">
          Submit
      </button>
        <p id="sudo">
            <script>
                function myGeeks() {
      
                    // set value of cite attribute  
                    var g = document.getElementById(
                      "GFG").cite = "www.GeeksForGeeks.com"
                    document.getElementById("sudo").innerHTML = 
                      "The value of the cite attribute was changed  to" + g;
                }
            </script>
    </body>
      
    </html>

    chevron_right

    
    

    Output:

    Before Clicking On Button:

    After Cliking On Button:

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

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


    My Personal Notes arrow_drop_up

    Check out this Author's contributed articles.

    If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




    Article Tags :
    Practice Tags :


    Be the First to upvote.


    Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.