Show/Hide text and form field based on drop down selection

Discussion in 'Javascript' started by Steve Speirs, Jun 27, 2003.

  1. Steve Speirs

    Steve Speirs Guest

    Hi

    I'm trying to show/hide a simple piece of text and a text field on a
    form based on what choice is made from a drop down box.

    <select name="dropdown" size="1">
    <option selected value="">Please make a selection</option>
    <option value="1">Choice 1</option>
    <option value="2">Choice 2</option>
    <option value="3">Choice 3</option>
    <option value="4">Other</option>
    </select>

    i.e. if Choice 2 is selected I'd like to display a new <tr> with the
    following:

    <tr>
    <td>New text field:</td>
    <td><input name="newField" type="text size="20"></td>
    </tr>

    if any other choices are made, I don't want to display anything.
    I've tried several onchange() functions but can't achieve what I'm
    looking for.

    Any help would be appreciated,
    Steve
     
    Steve Speirs, Jun 27, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jaysch
    Replies:
    0
    Views:
    1,245
    jaysch
    Apr 30, 2011
  2. Brett_A
    Replies:
    8
    Views:
    190
    Bob Barrows [MVP]
    Apr 19, 2008
  3. ehm
    Replies:
    2
    Views:
    206
  4. Replies:
    13
    Views:
    263
    Dr John Stockton
    Jan 28, 2005
  5. Replies:
    4
    Views:
    142
Loading...

Share This Page