Reversing hide show content toggle

I’m trying to do a simple change but can’t seem to get it to work

See the example here: https://www.w3schools.com/howto/howto_js_toggle_hide_show.asp

How do I get the content block to be hidden by default when you access the page and then have the content show when you click the button?

All you need to do is add display:none as in inline style or to your css

Inline version

<div id="myDIV" style="display: none;">
Click the button!
</div>

If you already have a style setup in your css for #myDiv, then you can add it to your style sheet instead

#myDiv {
  display:none;
}

Thanks - the inline version worked. I did try the css version earlier but there is a gremlin in the works somewhere. Anyhow - its working now.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.