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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:44:00+00:00 2026-06-13T12:44:00+00:00

I want my select box to dynamically change the CSS of another part of

  • 0

I want my select box to dynamically change the CSS of another part of the page so that the right options are visible according to each selection.

E.g. the right DIV elements are shown when the correlating select option is selected.

My select input and DIVs:

<select id="chooser" class="input_select" name="chooser">
<option value="">Select...</option>
<option value="Car">Car</option>
<option value="House">House</option>
<option value="Commercial">Commercial</option>
<option value="Other">Other</option>
</select>

<div id="car" style="display:none;">Cars</div>
<div id="house" style="display:none;">House related</div>
<div id="commercial" style="display:none;">Commercial stuff</div>
<div id="other" style="display:none;">Other stuff</div>

my jquery so far:

$(document).ready(function() {

$('#chooser').change{
  $('#house').hide()
  $('#commercial').hide()
  $('#other').hide()
  $('#car').show()
}
});

I’m a noob at jQuery and I just don’t know HOW to tell it to filter it by which option is selected. I mean, I think I added the .change{} part right but no idea how to filter it.

Any help is appreciated. Thanks

  • 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-13T12:44:01+00:00Added an answer on June 13, 2026 at 12:44 pm

    There is a syntax error in your code, you should pass a function for the change event, try the following:

    $(document).ready(function() {
       $('#chooser').change(function(){
          var w = this.value.toLowerCase();
          $('div').hide().filter('#'+w).show();
       })
    });
    

    http://jsfiddle.net/ss5G9/

    Surely hiding all the div elements on the page is not a good idea, you can add classes to your div elements and hide those specific div elements instead.

    <div id="car" class='div' style="display:none;">Cars</div>
    <div id="house" class='div' style="display:none;">House related</div>
    <div id="commercial" class='div' style="display:none;">Commercial stuff</div>
    <div id="other" class='div' style="display:none;">Other stuff</div>
    

    $(document).ready(function() {
       $('#chooser').change(function(){
          var w = this.value.toLowerCase();
          $('.div').hide().filter('#'+w).show();
       }).change()
    });
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a select box that gets generated dynamically. I want to allow users
I have a dynamically populated (by ajax) select box with resulting options like that:
I want to have on my site a single select box that will then
When user clicks on select box , I want to hide the options menu
I want select box B to become visible when option 2 is selected in
I want to add checkbox element to a combo box / select element dynamically.
I want to call onchange function dynamically when user change value of another combo
At the moment I have a PHP/HTML select box that is created dynamically from
i have the following select box and want to sort it by display:none inlne
I want to assign a value from a select box to an input field

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.