Change DIV on select

Posted on 2012-08-24
Last Modified: 2012-08-28
I need to change an input in a cfform from A to B when a selection is made from a select above the inputs. Input A has an autosuggest list that works for Authors and this is the default. I have to add a list for Owners that is input B. So when someone goes to the site and selects Owners from the dropdown select box the div containing input B replaces input A. I can use javascript or jQuery 1.6
Question by:WAlexxe
    LVL 12

    Accepted Solution


    Here you go. (online demo )

    <select id="select">
        <option value="1">111</option>
        <option value="2">222</option>
        <option value="3">333</option>
    <div id="warning" style="display:none">NO!!!</div>
    <div id="message"  >Message!!!</div>
    jQuery Code;
    $(function() {
            if ($(this).val() == "2") {
            } else {

    Open in new window


    Author Closing Comment

    Worked like a charm!! Thanks!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
    Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    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

    10 Experts available now in Live!

    Get 1:1 Help Now