+ 1

Please help me in javascript

https://code.sololearn.com/Wd6QgX91YPMw/?ref=app I want to create start value button , which get hide when clicked and a input element and set button appear , which takes a value for counting input . After clicking on set button value set to counting input box and both below input element and set button disappear and again same button - start value appear.

10th May 2021, 5:55 PM
mustafa raza
mustafa raza - avatar
2 Answers
+ 2
firstly you must remove parenthesis of your addEventListener arguments at end of your 'setValue' function: the ones after "click" to set a valid event name, and the one after the function name to pass the function itself rather than passing the function call result... function setValue(){ // ... document.getElementById("setButton").addEventListener("click",saveValue); } then you could uncomment the 'saveValue' function body, and add at least a line to reset the 'display' property of the 'startButton' to let it appear again: function saveValue(){ document.getElementById("setButton").remove(); document.getElementById("setValue").remove(); document.getElementById("startButton").style.display=""; } Obviously, that's enough to get the desired behavior, but you doesn't update the counter value with only these steps: before removing te 'setValue' input, you should read its 'value' property and set it to your counter ;P
11th May 2021, 7:49 PM
visph
visph - avatar
+ 1
visph thank you
13th May 2021, 9:54 AM
mustafa raza
mustafa raza - avatar