Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 793365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:08:26+00:00 2026-05-14T22:08:26+00:00

I’m in need to toggle divs from a dropdown select option box. I’d like

  • 0

I’m in need to toggle divs from a dropdown select option box. I’d like it similar to asmselect for jquery but instead of listing the option tag I’d like it to display a hidden div. Is there anything like this out there? Or anyone know how to set it up? Thanks, Jeff.

UPDATED

Basically what I want is the look and interaction of the asmselect link above though toggling divs instead of generating a list. Example code below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jQuery1.3.js"></script>
<script type="text/javascript">

$(document).ready(function(){

    $("#theSelect").change(function(){          
        $("#theSelect option:selected").click(function(){
            var value = $(this).val();
            var theDiv = $(".is" + value);

            $(theDiv).toggle(function(){
                $(this).removeClass("hidden");
            }),function(){
                $(this).addClass("hidden");
            }
        }); 
    });

});

</script>
<style type="text/css">
.hidden {
    display: none;
}
</style>
</head>

<body>
    <div class="selectContainer">
        <select id="theSelect">
            <option value="">- Select -</option>
            <option value="Patient">Patient</option>
            <option value="Physician">Physician</option>
            <option value="Nurse">Nurse</option>
        </select>
    </div>
    <div class="hidden isPatient">Patient</div>
    <div class="hidden isPhysician">Physician</div>
    <div class="hidden isNurse">Nurse</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:08:26+00:00Added an answer on May 14, 2026 at 10:08 pm

    Were you looking for something like this? http://jsfiddle.net/tYvQ8/

    $("#theSelect").change(function() {          
        var value = $("#theSelect option:selected").val();
        var theDiv = $(".is" + value);
    
        theDiv.slideDown().removeClass("hidden");
        theDiv.siblings('[class*=is]').slideUp(function() { $(this).addClass("hidden"); });
    });​
    

    When the select option changes, you

    • Reveal the selected div with slideDown() and remove its hidden class.
    • Find the divs siblings that have “is” in the class name. (Be easier if the menu wasn’t a sibling.)
    • Hide the previously displayed siblings with slideUp(), which takes a callback to add the hidden class after the slideUp() is complete

    Here’s another (in my opinion, better) way: http://jsfiddle.net/tYvQ8/1/

    Get rid of your hidden class, and use jQuery to hide them. Then you don’t have to worry about adding and removing the class.

    HTML without hidden class

    <body>
        <div class="selectContainer">
            <select id="theSelect">
                <option value="">- Select -</option>
                <option value="Patient">Patient</option>
                <option value="Physician">Physician</option>
                <option value="Nurse">Nurse</option>
            </select>
        </div>
        <div class="isPatient">Patient</div>
        <div class="isPhysician">Physician</div>
        <div class="isNurse">Nurse</div>
    </body>​
    

    jQuery

    $('[class^=is]').hide();
    
    $("#theSelect").change(function(){          
        var value = $("#theSelect option:selected").val();
        var theDiv = $(".is" + value);
    
        theDiv.slideDown();
        theDiv.siblings('[class^=is]').slideUp();
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The different is the way you add the record and… May 16, 2026 at 2:18 pm
  • Editorial Team
    Editorial Team added an answer The quintessential book on Lisp macros is probably Paul Graham's… May 16, 2026 at 2:18 pm
  • Editorial Team
    Editorial Team added an answer if it's shoes your after, nobody knows. May 16, 2026 at 2:18 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.