jQuery Tutorial: Input / Select Box Toggle

Published on August 16, 2008

An entry in Web that deals with

When I was designing part of Love Your Pet Forever’s administration module, I came up with a simple solution to toggle between select boxes and input elements that would, when toggled on or off, post the value to a single desired location.

You can read the full tutorial at Taming the Wild Wild Web, or view the live demo at flexible philosophy.

2 Responses to “jQuery Tutorial: Input / Select Box Toggle”

  1. Jeff L Says:

    Can’t comment at the article itself without logging in.

    You say in the article:

    If the select box was changed to ‘other’, we remove the name attribute from the select box and display the input field.

    However, you never remove the ‘name’ attribute from the select. You are simply adding it to the input field, and passing two values for each ‘name’.

  2. Jeffrey Olchovy (1 comments.) Says:

    Correct -

    but, on page load the name attribute is removed from the select box if it is not set to other. Which demands an edit in the article.

    This solution is a very simple, and rather dirty, way to handle the problem. Check out ajaxian.com for improved solutions. I came about writing this after using its basic logic on a much more complex form.

Leave a Reply