How create a Toogle Button on click show on click hide | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How create a Toogle Button on click show on click hide

29th Jun 2018, 10:32 AM
Joytiarjun
Joytiarjun - avatar
5 Respostas
+ 4
Do you want to hide the button ā€˜onclickā€™? Please make your questions easy to understand.
29th Jun 2018, 10:39 AM
Agent
Agent - avatar
+ 2
I have created something like that in my code : see line 41-43 https://code.sololearn.com/WViGlJaze6iY/?ref=app
29th Jun 2018, 10:52 AM
RZK 022
RZK 022 - avatar
+ 1
onclick hide what? the button? some other element?
29th Jun 2018, 12:04 PM
Paul James Semler
Paul James Semler - avatar
30th Jun 2018, 7:50 AM
Joytiarjun
Joytiarjun - avatar
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 " "
30th Jun 2018, 3:12 PM
Paul James Semler
Paul James Semler - avatar