Vidyalelo
JavaScript · Q68

Server

Programming · JavaScript · question 68

Q68

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(); }
Answer
C.
timestamp.onclick = function() { innerHTML = new Date().toString(); }
D.
None of the above

Answer: Option B

Solution

Answer: Option B
Solution:
The above code snippet updates the content of the timestamp element when the user clicks on it.