Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] dynamically hide an element


  • From: nick at nickfitz.co.uk (Nick Fitzsimons)
  • Subject: [Javascript] dynamically hide an element
  • Date: Wed Nov 29 06:54:13 2006

On 29 Nov 2006, at 13:25:28, Fl?vio Gomes wrote:

>  What I'm going to talk is css related, but I believe it fits in  
> the topic:
>
>  If you set display to none the element disappears, period.
>
>  But when you want it to be shown again you have to take care on  
> which of the options to take, inline or block.
>
>  If you set it to "block" it'll create a line break after and  
> before the selected element. For a DIV that wouldn't be a great  
> problem, but for an image or a form element It'd be.
>

The thing to do if you might be setting the value of "display" on  
either block or inline elements is to set it to the empty string "".  
That way, it will just revert to its default value, or any value  
specified in a stylesheet that overrides the default. But generally,  
the class-setting technique described earlier in this thread by Mark  
Kelly is the best way to go, if possible.

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/