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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:59:06+00:00 2026-05-26T16:59:06+00:00

I have a page with several multiselect drop-down menus. Each menu has a general

  • 0

I have a page with several multiselect drop-down menus. Each menu has a general category, for example:

Box1: Fruits         Box2: Veggies
 - Peach              - Celery
 - Orange             - Broccoli
 - Apple              - Spinach

On the page are objects which contain up to one class from each dropdown.

When a class is selected from a dropdown, these objects are filtered based on the selected class and only those which contain the class are displayed. For example, if you select “Peach” from the first drop down, all the Apples and Oranges would be hidden. (.peach)

Since you are able to select multiple items from a dropdown, you can then also select “Apple” causing both the “Apple” and “Peach” objects to display, but not the Oranges. (.peach, .apple)

Alternatively, you could select one of the veggies, and it will only display objects which contain both. (.peach.spinach)

The problem I’m having is that I can’t figure out how to extend this so that I can have something as complex as “Objects which are ((Apples OR Peaches) AND (Spinach OR Broccoli))” I recognize that I could do (.apple.spinach, .apple.broccoli, .peach.spinach, .peach.broccoli) however this seems like it would end up needlessly complex, especially as the size of the menus, number of menus, and number of options selected grows (I simplified to two for the example).

I’ve tried several ways of solving this, such as:

//:has() does not appear to be useable in this fashion
(:has(.peach, .apple):has(.spinach, .broccoli)) 

//multiple selectors within brackets[] doesn't appear to be supported
([class~='apple', class~='peach'][class~='spinach', class~='broccoli'])

//grouping OR sets doesn't appear to help:
((.peach, .apple)(.spinach, .broccoli))

Is there some simple way of doing this that I’m missing or screwing up? Or am I forced to create some heavy loops to generate all the possible AND combinations?

  • 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-26T16:59:07+00:00Added an answer on May 26, 2026 at 4:59 pm

    A multiple selector can indeed be used to implement the OR operator. To implement the AND operator between two expressions, you can use filter():

    // ((Apples OR Peaches) AND (Spinach OR Broccoli))
    var matches = $(".peach, .apple").filter(".spinach, .broccoli");
    

    You can chain calls to filter() if you have multiple expressions:

    // ((Apples OR Peaches) AND (Spinach OR Broccoli) AND (Dragon OR Unicorn))
    var matches = $(".peach, .apple")
                  .filter(".spinach, .broccoli")
                  .filter(".dragon, .unicorn");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that has several ajax submission forms. Each form has a
I have several ReorderLists on a page. Each list has items added to it
I have a page with several drop down lists that all have the same
I have an HTML 5 page with several articles. Each article has a custom
Here's my scenario: I have a page containing several links; each link is meant
I have a page which has several <canvas> elements. I am passing the canvas
I have a login page that has several textboxes on the page, one of
I have a complex page that has several user controls like galleries, maps, ads
I have a page with several iframes. One of this iframes has a page
I have an HTML page with several iframes, each pointing to a text file

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.