Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM del cite Property

  • Difficulty Level : Basic
  • Last Updated : 17 Oct, 2019

The DOM del cite Property in HTML DOM is used to set or return the value of the cite attribute of a <del> element. The cite attribute is used to specify the URL of the document or message which denotes the reason for deleting the text. It has no visual effect on any ordinary Web Browser. It can only be used by screen readers.

Syntax:

  • It returns the cite property.
    delObject.cite
  • It is used to set the cite property.
    delObject.cite = URL

Property Vaues:

  • URL: It specifies the URL of the document that defines why the text was deleting other previous text.
    Possible values are:
    1. Absolute URL: It is used to point out other websites (like cite =”http://www.w3schools.com”)
    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 source document.



    Example-1: This Example returns the cite Property.




    <!DOCTYPE html>
    <html>
      
    <head>
        <title>
          HTML DOM Del cite Property
      </title>
        <style>
            del {
                color: red;
            }
              
            ins {
                color: green;
            }
        </style>
    </head>
      
    <body style="text-align:center;">
        <h1>
          GeeksforGeeks
      </h1>
      
        <h2>
          DOM Del cite Property
      </h2>
      
        <p>
            GeeksforGeeks is a 
          <del id="GFG" 
               cite="www.GeeksForGeeks.com"
                mathematical</del
          <ins>
            computer</ins> science portal
        </p>
      
        <button onclick="myGeeks()">
            Submit
        </button>
      
        <p id="sudo"
           style="Font-size:25px;
                  color:green;">
      </p>
      
        <script>
            function myGeeks() {
                var g =
                    document.getElementById("GFG").cite;
                
                document.getElementById(
                  "sudo").innerHTML = g;
            }
        </script>
      
    </body>
      
    </html>

    Output:
    Before Clicking On Button:

    After Clicking On Button:

    Example-2: This Example sets the cite Property.




    <!DOCTYPE html>
    <html>
      
    <head>
        <title>
          HTML DOM Del cite Property
      </title>
        <style>
            del {
                color: red;
            }
              
            ins {
                color: green;
            }
        </style>
    </head>
      
    <body style="text-align:center;">
        <h1>GeeksforGeeks</h1>
      
        <h2>
          DOM Del cite Property
      </h2>
      
        <p>
            GeeksforGeeks is a
          <del id="GFG"
               cite="www.GeeksForGeeks.com"
                mathematical
          </del
          <ins>computer</ins> science portal
        </p>
      
        <button onclick="myGeeks()">
            Submit
        </button>
      
        <p id="sudo" 
           style="Font-size:25px;
                  color:green;">
      </p>
      
        <script>
            function myGeeks() {
                var g = 
                    document.getElementById(
                      "GFG").cite = 
                    "www.finecomb.com";
                
                document.getElementById(
                  "sudo").innerHTML = 
                  "The cite attribute was changd to " + g;
            }
        </script>
      
    </body>
      
    </html>

    Output:

    Before Clicking On Button:

    After Clicking On Button:

    Supported Browsers: The browser supported by DOM Del cite property are listed below:

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

    Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.




    My Personal Notes arrow_drop_up
Recommended Articles
Page :