Show/Hide a DIV | JavaScriptSource

Show/Hide a DIV

Justin Barlow Feb 29, 2008


Showing and hiding a DIV using a link can be very useful when it's not necessary to always display information on the Web page. For example, this technique can be used for posting comments on a blog. That way you don't need to use a popup window or a separate page.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent porttitor luctus quam. Pellentesque diam libero, feugiat quis, porttitor sagittis, suscipit dignissim, pede. Duis dapibus mauris at enim. Morbi vehicula turpis nec massa.

Add a comment




Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: showHideDiv.js


Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


Paste this code into the HEAD section of your HTML document.


Paste this code into the BODY section of your HTML document

Leave a Response


Thanks. It's working now.

Lee Oct 31, 2008

Is it possible to make the default toggle position = "Hidden".[br /]When page is opened the text box etc is visible and I feel should not be[br /]Thanks

Terry Ledwith Mar 3, 2008

I had to copy the source code, and paste it into my own sheets. The link is broken to e-mail it to myself.

lawrence farell Feb 29, 2008