Javascript onChange Script To Make Form Area Appear or Disappear

Posted on 2007-10-10
Last Modified: 2012-05-05
In a website I am working on, I want to display/hide an area of a form according to the value selected from a scroll-down by the user.
Question by:gianchi66
    LVL 75

    Expert Comment

    by:Michel Plungjan
    <select onChange="var val=this.options[this.selectedIndex].value;
    <option value="">Please select</option>
    <option value="A">A</option>
    <option value="other">Other</option>
    <div id="other" style="display:none"><input type="text" name="otherValue" value=""></div>
    LVL 75

    Accepted Solution


    Author Comment

    I cracked up.

    Isn't that beautiful? I even forgot I had asked that question already...

    Do you have kids? That's how you loose your memory.
    LVL 75

    Expert Comment

    by:Michel Plungjan
    Ohhh, I thought it was the pints...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now