Javascript DOM HTML ins dateTime Property set

Introduction

Change the value of the datetime attribute:

document.getElementById("myIns").dateTime = "2014-10-13T21:34:07Z";

Click the button to change the value of the datetime attribute of the inserted text.

View in separate window

<!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>/*from w  w w . jav  a2  s .  com*/
<p id="demo"></p>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
  document.getElementById("myIns").dateTime = "2014-10-13T21:34:07Z";
  document.getElementById("demo").innerHTML = "The value of the datetime attribute was changed.";
}
</script>

</body>
</html>



PreviousNext

Related