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 9074365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:37:09+00:00 2026-06-16T18:37:09+00:00

I have a switch statement that I am using in the drop down menus

  • 0

I have a switch statement that I am using in the drop down menus

I want to add html code in each of the cases like links,images, etc..

the header tag in the index.html

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript" defer="defer">
    function showDetails(){
        var org = $("#org").attr("value");
        var div1 = $("#div1");

       switch(org)
        {
        case "1":
          div1.html("this is all about organization 1");
          break;
        case "2":
          div1.html("this is all about organization 2");
          break;
        case "3":
          div1.html("this is all about organization 3");
          break;
        default:
          div1.html("Select Organization");
        }
        $("#div2").fadeOut(300);
        div1.fadeIn(300);
    }

    function TerritoryDetails(){
        var terr = $("#terrSelect").attr("value");
        var div = $("#div2");
        div.fadeIn(300);
        $("#div1").slideUp(300); //hide organization (optional)
       switch(terr)
        {
        case "1":
          div.html("this is all about Territory 2");
          break;
        case "2":
          div.html("this is all about Territory 2");
          break;
        case "3":
          div.html("this is all about Territory 3");
          break;
        case "4":
          div.html("this is all about Territory 4");
          break;
        case "5":
          div.html("this is all about Territory 5");
          break;
        case "6":
          div.html("this is all about Territory 6");
          break;
        case "7":
          div.html("this is all about Territory 7");
          break;
        default:
          div.html("Select Territory");
        }
    }



    function cascadeSelect(parent, child){
            var childOptions = child.find('option:not(.static)');
                child.data('options',childOptions);

            parent.change(function(){
                childOptions.remove();
                child
                    .append(child.data('options').filter('.sub_' + this.value))
                    .change();
            })

            childOptions.not('.static, .sub_' + parent.val()).remove();

    }

    $(function(){
        cascadeForm = $('.cascadeTest');
        orgSelect = cascadeForm.find('.orgSelect');
        terrSelect = cascadeForm.find('.terrSelect');
        locSelect = cascadeForm.find('.locSelect');

        cascadeSelect(orgSelect, terrSelect);
        cascadeSelect(terrSelect, locSelect);
    });
</script>

the full code is here

http://jsfiddle.net/5tmwg/5/

I lack experience in javascript and jQuery

thanks in advance

  • 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-06-16T18:37:10+00:00Added an answer on June 16, 2026 at 6:37 pm

    you are on the right path.

    this is all about organization 1

    you can replace those strings with html code for example

    `div1.html("<p style='color:#0066cc'>this is all about organization 1<p>");`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have a piece of code that has a switch statement and some
I have a switch statement that has over 300 case statements. case 'hello': {
I have a switch case statement that doesn't work. I've checked the input, it's
I have a rather long switch-case statement. Some of the cases are really short
I have kept hearing this statement. Switch..Case is Evil for code maintenance, but it
I have a form in C# with a drop down box. When that drop
I've recently learned that python doesn't have the switch/case statement. I've been reading about
I have a php page that contains a form with 7 drop down boxes.
I have 2 drop downs and I'm using the switch to populate the second
I have recently learned that you can use a neat switch statement with fallthrough

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.