The datetime
attribute sets when the text was deleted.
The dateTime
property sets or gets the datetime attribute for
del
element.
dateTime |
Yes | Yes | Yes | Yes | Yes |
Return the dateTime property:
delObject.dateTime
Set the dateTime property:
delObject.dateTime = YYYY-MM-DDThh:mm:ssTZD;
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ssTZD | When the text was deleted.
|
A string value of when the text was deleted.
The following code shows how to set the datetime attribute.
<!DOCTYPE html>
<html>
<body>
<del id="myDel" datetime="2012-12-12T22:22:03Z">deleted</del>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from ww w . j a va 2s . c o m-->
document.getElementById("myDel").dateTime = "2015-15-15T21:45:07Z";
document.getElementById("demo").innerHTML = "changed";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get when text was deleted.
<!DOCTYPE html>
<html>
<body>
<del id="myDel" datetime="2011-11-11T21:51:03Z">deleted</del></p>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from ww w . ja va 2 s. c o m-->
var x = document.getElementById("myDel").dateTime;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: