0

How create a Toogle Button on click show on click hide

29th Jun 2018, 10:32 AM
Joytiarjun
Joytiarjun - avatar
5 ответов
+ 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