0
How create a Toogle Button on click show on click hide
5 Answers
+ 4
Do you want to hide the button âonclickâ?
Please make your questions easy to understand.
+ 2
I have created something like that in my code :
see line 41-43
https://code.sololearn.com/WViGlJaze6iY/?ref=app
+ 1
onclick hide what? the button? some other element?
0
since its just text you want to toggle, you could use a variable to toggle hidden or shown. toggle could start at 1 and onclick it would change between 1 and 0 every time.
then your function could say
document.getElementById("item").innerHTML = "whatever you want it to say";
to hide text you can just set .innerHTML to " "