Hide/Show Toggle |
Hide/Show Toggle |
Slushie |
Apr 1 2020, 08:39 PM
Post
#1
|
Group: Members Posts: 2 Joined: 1-April 20 Member No.: 27,262 |
Hopefully this will be an easy fix for someone.
I'm trying to implement the Hide/Show toggle at https://www.w3schools.com/howto/tryit.asp?f...oggle_hide_show The script part of it is <script> function myFunction() { var x = document.getElementById("myDIV"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> My question is, the page always starts with the item being shown, not hidden. How do I make it when the page is first loaded the item is hidden, not shown? Thanks for any help with this. |
Slushie |
Apr 2 2020, 09:01 PM
Post
#2
|
Group: Members Posts: 2 Joined: 1-April 20 Member No.: 27,262 |
Thank you pandy! I appreciate it.
That worked perfectly. |
pandy |
Apr 2 2020, 09:05 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,733 Joined: 9-August 06 Member No.: 6 |
Good.
|
Lo-Fi Version | Time is now: 27th April 2024 - 11:22 AM |