HTML DOM Del Object
The Del Object in HTML DOM is used to represent the HTML <del> element. The <del> element can be accessed by getElementById().
Object Properties:
Syntax:
document.getElementById("ID");
Where the ID attribute is the ID assigned to the <del> tag.
Example 1: In this example, we will see the use of DOM Del Object
HTML
<!DOCTYPE html> < html > < head > < title >HTML DOM Del Object</ title > < style > del { color: red; } ins { color: green; } </ style > </ head > < body > < h1 >w3wiki</ h1 > < h2 >DOM Del Object</ h2 > < p > w3wiki is a < del id = "GFG" datetime = "2018-11-21T15:55:03Z" > mathematical </ del > < ins >computer</ ins > science portal </ p > < button onclick = "myBeginner()" > Submit </ button > < p id = "sudo" ></ p > < script > function myBeginner() { let g = document.getElementById("GFG").dateTime; document.getElementById("sudo").innerHTML = g; } </ script > </ body > </ html > |
Output:
Example 2: Del Object can be created by using the document.createElement Method.
HTML
<!DOCTYPE html> < html > < head > < title > HTML DOM Del Object </ title > < style > del { color: red; } ins { color: green; } </ style > </ head > < body > < h1 >w3wiki</ h1 > < h2 >DOM Del Object</ h2 > < button onclick = "myBeginner()" > Submit </ button > < p id = "sudo" ></ p > < script > function myBeginner() { let g = document.createElement("DEL"); let f = document.createTextNode("w3wiki"); g.appendChild(f); document.body.appendChild(g); } </ script > </ body > </ html > |
Output:
Supported Browsers: The browser supported by DOM Del Object are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari