Open In App

HTML DOM del cite Property

Improve
Improve
Like Article
Like
Save
Share
Report

The 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 Values:

  • URL: It specifies the URL of the document that defines why the text was deleting other previous text. Possible values are:
    • Absolute URL: It is used to point out other websites (like cite =”http://www.geeksforgeeks.org”)
    • Relative URL: It is used to point out the page within the website. (like cite=”geeks.html”)

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

Example 1: This example returns the cite property.

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Del cite Property
    </title>
 
    <style>
        body {
            text-align: center;
        }
 
        del {
            color: red;
        }
 
        ins {
            color: green;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
 
    <h2>HTML DOM Del cite Property</h2>
 
    <p>
        GeeksforGeeks is a
        <del id="GFG" cite="www.geeksforgeeks.org">
            mathematical</del>
        <ins>
            computer</ins> science portal
    </p>
 
    <button onClick="myGeeks()">
        Click Here!
    </button>
 
    <p id="result"></p>
 
    <script>
        function myGeeks() {
            let citeVal = document
                .getElementById("GFG").cite;
 
            document.getElementById("result")
                .innerHTML = citeVal;
        }
    </script>
</body>
 
</html>


Output:

del-cite

Example 2: This example sets the cite property.

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Del cite Property
    </title>
 
    <style>
        body {
            text-align: center;
        }
 
        del {
            color: red;
        }
 
        ins {
            color: green;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
 
    <h2>HTML DOM Del cite Property</h2>
 
    <p>
        GeeksforGeeks is a
        <del id="GFG" cite="www.gfg.com">
            mathematical
        </del>
        <ins>computer</ins> science portal
    </p>
 
    <button onClick="myGeeks()">
        Click Here!
    </button>
 
    <p id="result"></p>
 
    <script>
        function myGeeks() {
            let citeVal = document.getElementById("GFG")
                .cite = "www.geeksforgeeks.org";
 
            document.getElementById("result").innerHTML
                = "The cite attribute changd to " + citeVal;
        }
    </script>
</body>
 
</html>


Output:

del-cite-2

Supported Browsers:

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


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