Home / CSE / Javascript - CS :: Discussion

Discussion :: Javascript - CS

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

  2. 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(); }

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The above code snippet updates the content of the timestamp element when the user clicks on it.


Be The First To Comment