Web Hosting Talk







View Full Version : visibility:hidden for script


FG-alex
12-01-2007, 05:16 AM
Hi, I am currently using a few hidden elements but I need them to actually hide the content rather than just make it dissapear [what I mean is when I add visibility:hidden it just leaves a black spot between the text rather than 'collapsing' it instead!]

Also, the code I have within the hidden div tag still executes. Is there any way to stop it from doing so when the element is hidden?

AnS_
12-01-2007, 10:51 AM
To remove the element:
x.style.visibility = 'hidden';
x.style.display = 'none';

To put it back:
x.style.visibility = 'visible';
x.style.display = 'block';

stripeyteapot
12-01-2007, 03:11 PM
Also, the code I have within the hidden div tag still executes. Is there any way to stop it from doing so when the element is hidden?

Give the function a trigger, so it requires X action to run.

FG-alex
12-02-2007, 12:42 AM
The display tag did it. Thanks!