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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:33:55+00:00 2026-06-16T01:33:55+00:00

My recent question: jQuery select menu show siblings with same ID hide other siblings

  • 0

My recent question: jQuery select menu show siblings with same ID hide other siblings

Allowed me to show/hide list items using select menu option values: http://jsfiddle.net/Z3Qgz/

If I add a second select menu, how can I link the two select menus together so that the list items displayed, represent the values selected in both menus?

$(function() {
    var $li = $('.levelThree').find('li')
    $("#orientation").change(function() {
        if (this.value == 'all') {
            $li.show();
        }
        else {
            $li.hide().filter("." + this.value).show();
        }
    }).change();
});
$(function() {
    var $li = $('.levelThree').find('li')
    $("#colours").change(function() {
        if (this.value == 'all') {
            $li.show();
        }
        else {
            $li.hide().filter("." + this.value).show();
        }
    }).change();
});

http://jsfiddle.net/dRqRV/2/

E.g. Selecting “Landscape” and “CMYK” will display only list items that have a class “Landscape CMYK”.

  • 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-16T01:33:56+00:00Added an answer on June 16, 2026 at 1:33 am

    You can add 2 other classes to the elements and use class selector, this way there is no need to use if/else statements.

    <select id="orientation">
        <option value="all-orientations">All</option>
        ...
    </select>
    <select id="colours">
        <option value="all-colours">All</option>
        <option value="CMYK">CMYK</option>
        ...
    </select>
    
    <!-- the DIVs -->
    <ul class="levelThree">
        <li class="Landscape CMYK all-colours all-orientations"><p>Landscape CMYK</p></li>
        <li class="Landscape RGB all-colours all-orientations"><p>Landscape RGB</p></li>
        <li class="Landscape PMS all-colours all-orientations"><p>Landscape PMS</p></li>
        ...
    </ul>
    

    $(function() {
        var $li = $('.levelThree').find('li')
        $("#orientation, #colours").change(function() {
            var a = $("#orientation").val();
            var b = $("#colours").val();
            $li.hide().filter("." + a + "." + b).show();
        }).change();
    });
    

    http://jsfiddle.net/3jRQq/

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

Sidebar

Related Questions

Background: On a recent website, I'm using a jQuery driven dropdown menu in addition
I was just reading a recent question on using conditionals in Linq and it
As I mentioned in a recent question on how to show strings with carriage
Searching around I haven't found any recent answers to this question. The other answers
On a recent question about MVC attributes, someone asked whether using HttpPost and HttpDelete
This is similar to a recent question. I will be maintaining sorted a list
In a recent question I was encouraged to try using some basic data structures
In a recent question , I received suggestions to talk on, amongst other things,
In a recent question, someone asked if they could make a time just using
In a recent question about using Excel a couple of the suggested answers used

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.