How to Toggle Html Display With Javascript
Here's a quick javascript trick to control display settings. All we do is set the display of an element to none, and then use a javascript function to toggle the display when a user clicks something else.
[edit] Steps
- So pick an id and set it's style="display:none" (if this is in the css however, the javascript won't override it, so just put it as an element attribute).
- Then attatch a javascript onclick event to a link or anything really, I used a link just because it's something we are used to clicking on.
- Add this javascript function to the page. It searches the DOM for the element id (getElementById) and toggles the display state.










