+ 4

Javascript question [Solved]

https://code.sololearn.com/W13VPtCiUsbl/?ref=app In the code, while displaying the notes, the time displayed is when the page loads, how can I display the time when the submit button is clicked?

25th Sep 2020, 6:07 AM
Tarush Mohindru
Tarush Mohindru - avatar
6 Answers
+ 1
Tarush Mohindru You can use the same method used in function `app` for getting a new Date object and query the hour, minute and second, only this time you apply it inside the add button click event handler $("#add").on("click",function(). I think you can do this 👍
25th Sep 2020, 8:11 AM
Ipang
+ 3
<body onload=""> <button id="add" onclick="app()">Submit</button>
25th Sep 2020, 6:36 AM
Gordon
Gordon - avatar
+ 2
You are using variable <h>, <m>, <s> and <ampm> which is initialized when the page loads. You need to use a current Date object to use the time of submission. Focus on line 50.
25th Sep 2020, 6:34 AM
Ipang
+ 2
Ipang could you please help me with the syntax
25th Sep 2020, 7:46 AM
Tarush Mohindru
Tarush Mohindru - avatar
+ 2
Thanks Ipang, the problem is solved
25th Sep 2020, 8:53 AM
Tarush Mohindru
Tarush Mohindru - avatar
+ 1
Good job bro! 👍
25th Sep 2020, 9:32 AM
Ipang