<p>The paragraph <del datetime="2021-11-01">has been</del> changed</p>HTMLModElement: dateTime property / notebook
HTMLModElement: dateTime property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const deletedText = document.querySelector("del");
console.log(deletedText.dateTime); // "2021-11-01"const insertedText = document.createElement("ins");
const now = new Date();
insertedText.dateTime = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
insertedText.appendChild(document.createTextNode("was"));
deletedText.insertAdjacentElement("afterend", insertedText);<p>
The paragraph <del datetime="2021-11-01">has been</del
><ins datetime="2025-1-9">was</ins> changed
</p>