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


    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>

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

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

    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 Speirs, Jun 27, 2003
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.