Javascript examples for DOM HTML Element:Ins
The dateTime property sets or gets the datetime attribute of an inserted text, which identifies the date and time of when the text was inserted.
Set the dateTime property with the following Values
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ssTZD | Sets the date and time of when the text was inserted/changed. |
A String, representing the date and time of when the text was inserted
The following code shows how to return the date and time of when some text was inserted:
<!DOCTYPE html> <html> <body> <p>This is a text. <ins id="myIns" datetime="2012-09-15T22:55:03Z">This is an inserted text.</ins> </p>/* w ww. j ava 2 s.c o m*/ <p id="demo"></p> <button onclick="myFunction()">Test</button> <script> function myFunction() { var v = document.getElementById("myIns").dateTime; document.getElementById("demo").innerHTML = v; } </script> </body> </html>