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

  • Home
  • SEARCH
  • 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 1029925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:37:18+00:00 2026-05-16T12:37:18+00:00

The title might be a bit confusing, basically I’m trying to write up a

  • 0

The title might be a bit confusing, basically I’m trying to write up a script which will grab the selected values from a drop down form, and hide li’s if its class does not contain the values from the drop down form.. if that makes sense?? Each li has multiple classes..

Here’s what I’ve got so far (sorry if it’s crude):

FORM:

<form action="" name="filter" id="filter" method="post">
        <select name="bedrooms">
          <option value="">- Select Bedrooms -</option>
          <option value="bed-1">1</option>
          <option value="bed-2">2</option>
          <option value="bed-3">3</option>
          <option value="bed-4">4</option>
          <option value="bed-5">5</option>
        </select>
        <select name="bathrooms">
          <option value="">- Select Bathrooms -</option>
          <option value="bath-1">1</option>
          <option value="bath-2">2</option>
          <option value="bath-3">3</option>
          <option value="bath-4">4</option>
          <option value="bath-5">5</option>
        </select>
        <select name="frontage">
          <option value="">- Select Frontage Size -</option>
          <option value="frontage-100">100</option>
          <option value="frontage-200">200</option>
          <option value="frontage-300">300</option>
          <option value="frontage-400">400</option>
          <option value="frontage-500">500</option>
        </select>
        <input type="submit" name="filter-submit" id="filter-submit" value="Go" />
      </form>

JQuery:

$("#filter-submit").click(function() {

          var foo = [];
          $("#filter :selected").each(function(i, value){
            foo[i] = $(value).val();
          });
          if (foo) {
            $.each(foo, function(index, value){
              if (value) {
                //hide other objects based on "value"
                //$("#portfolio li").hasClass();
            };
            });
          };

        return false;
        });

Ok so where I’m stuck is how to hide all “#portfolio li”‘s which don’t have the class which is outputted as “value”. I thought I could use hasClass but not sure how to reverse it.. if that makes sense? Any help would be appreciated 🙂

  • 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-16T12:37:19+00:00Added an answer on May 16, 2026 at 12:37 pm

    You could use .not() and pass the class, like this:

    $("#filter-submit").click(function() {
      var lis = $("#portfolio li");          //get all of the <li> elements
      $("#filter select").each(function() {  //loop through selected classes
        var val = $(this).val();             //get selected value, could be blank
        if(val) lis = lis.not('.' + val);    //get only <li>s without the class
      });
      lis.hide();                            //hide the ones without all classes
      return false;                          //prevent default behavior
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 513k
  • Answers 513k
  • 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 As far as I can see in the manual, it… May 16, 2026 at 5:56 pm
  • Editorial Team
    Editorial Team added an answer Use getString(resID) but you'll need a Context Object though. It's… May 16, 2026 at 5:56 pm
  • Editorial Team
    Editorial Team added an answer Pure Java Look into Tritonus's clean room implementation of javasound… May 16, 2026 at 5:56 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

Title might be a bit confusing, so let me explain. I have a website
the title might be a little bit confusing, let me explain, ;) I have
The title might be a bit misleading, but I couldn't figure out a better
The title might be a bit misleading, but I don't know how else to
The title of this question might be a bit off but its the closest
The original question: The title of this question might be a bit clumsily phrased,
Ok, the title might sound a bit vague but I really can't think of
The title might be worded strange, but it's probably because I don't even know
This might seem a bit awkward but I want to start a console program
Okay, this is a little hard to explain, as the title might suggest. I

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.