Open In App

HTML DOM del cite Property

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:



Property Values:

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

Example 2: This example sets the cite property.




<!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:

Supported Browsers:


Article Tags :