Toggle Additional Info | JavaScriptSource

Toggle Additional Info

JavaScriptSource Staff Nov 9, 2007


Add this snippet to your forms when you need additional information but don't want to display the input boxes unless it is necessary. Easy to implement and expand.

Are you married?
Yes No


Source Code

Paste this source code into the designated areas.

External file

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


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


You'll need to post your question [a href=""]over on the forums[/a].

Lee Jun 26, 2008

You can't use the same words for a name and an id. If the id for the div is "id="maritalStatus", then you would need to change the name of the input elements to something like: name="maritalStatusQuery". It works that way.

Lee Jun 26, 2008

i follow the instruction, but after i click yes button , the boxes is not been displayed..[br /]pls help.

cda Feb 13, 2008

Hi, I love your script. Your example expands the toggle in internet explorer. I'm having trouble doing the same. It's working fine in Firefox, but I can't get the same results in internet explorer. Am I missing something?[br /][script removed by admin.]

Marilyn Roberts Jan 23, 2008

Not sure what you mean, Bernard.

Lee Dec 4, 2007