Q. 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(); }
πŸ’¬ Discuss
βœ… Correct Answer: (B) timestamp.onclick = function() { this.innerHTML = new Date().toString(); }
Explanation: The above code snippet updates the content of the timestamp element when the user clicks on it.
Explanation by: Mr. Dubey
The above code snippet updates the content of the timestamp element when the user clicks on it.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
155
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
99%
Success Rate