adplus-dvertising
frame-decoration

Question

What is the code snippet to update the content of the timestamp element when the user clicks on it?

a.

timestamp.onLoad = function() { this.innerHTML = new Date().toString(); }

b.

timestamp.onclick = function() { this.innerHTML = new Date().toString(); }

c.

timestamp.onload = function() { this.innerHTML = new Date().toString(); }

d.

timestamp.onclick = function() { innerHTML = new Date().toString(); }

Posted under JavaScript

Answer: (b).timestamp.onclick = function() { this.innerHTML = new Date().toString(); }

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the code snippet to update the content of the timestamp element when the user clicks on it?