• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

HTML Question

Thraxen

Diamond Member
What I need to do is set up a form where certain layers appear when certain checkboxes are checked and then disappear if the same boxes are unchecked. I can get the layer to appear when the boxes are checked (******), but can't get them to hide again when the box is unchecked. I need someone to give me an example of some code that can be used to do this.

Thanks!
 
Thraxen, post your code. You can do what you're talking about fairly easily using javascript. Just make the ****** event of the checkbox call a js function. The JS function will show or hide the layer depending on the current state of its visibility.
 
Sorry about the late reply, but here is the basic code with which I'm working. Keep in mind I don't know crap about HTML 🙂 Anyway, I just need to see how to make a layer appear and then disappear based on a check box:

 
Here's a simpler if less legible version of MrChad's code. 🙂

It's probably better to use visibility because display can be any number of things.

For some reason defaultChecked wasn't working so I had to use body on_Load to set the default for the checkbox (enabled by default since the div is enabled by default in my example).

To make the div default to off, use:

<div id="testArea" style="visibility: hidden">
and then remove the on_Load part.

OK, apparently when you refresh the page, the state of the checkbox is kept, at least in my browser. So you may need to keep the on_Load and force the checkbox off at page start. Whatever you want.
 
Back
Top