Skip to content
Advertisement

pass value from span tag to input tag

I have a counter in span tags, when I press Start the timer starts counting and when pressing Pause it is stopped. Now the question is, How do I pass the value from the counter to input tag when Pause clicked?

JavaScript

Script

JavaScript

Here it is as a runnable snippet:

JavaScript
JavaScript

Advertisement

Answer

I adjustment your script with template string javascript created with a variable time and improvement your double tags for a tag with id “time-span” and “time-input” both with return variable time Also in Clock inserted pad function property and acess inside start with self variable

See this code and working

Update

Improvement with new input time last show time after pause.

JavaScript
JavaScript
Advertisement