Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Del object
The HTML DOM Del object is associated with the HTML <del> element. It is used to represent the <del> element. Using the Del object we can create and access a <del> elememt.
Properties
Following are the properties for the Del object −
| Sr.No | Properties & Description |
|---|---|
| 1 |
cite To set or return the cite attribute value of the deleted text. |
| 2 |
dateTime To set or return the datetime attribute value of the deleted text. |
Syntax
Following is the syntax for −
Creating a Del object −
var p = document.createElement("DEL");
Example
Let us look at an example for the HTML DOM Del object −
<!DOCTYPE html>
<html>
<body>
<h2>del object example</h2>
<p>Click on the below button to create a DEL element with some text.</p>
<button onclick="delCreate()">CREATE</button>
<br><br>
<script>
function delCreate() {
var d= document.createElement("DEL");
var t = document.createTextNode("Deleted text is here");
d.appendChild(t);
document.body.appendChild(d);
}
</script>
</body>
</html>
Output
This will produce the following output −

On clicking the CREATE button −

In the above example −
We have first created a button CREATE that will execute the delCreate() method when clicked by the user −
<button onclick="delCreate()">CREATE</button>
The delCreate() method creates a <del> element using the createElement() and assigns it to the variable d. It then creates a text node with some text inside using the createTextNode() method. The text node is then appended to the <del> element using the appendChild() method of the del element and appending the text node to it.
The <del> element along with the text node is then appended to the document body using the document.body appendChild() method and passing the variable d as parameter −
function delCreate() {
var d= document.createElement("DEL");
var t = document.createTextNode("Deleted text is here");
d.appendChild(t);
document.body.appendChild(d);
}