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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:41:06+00:00 2026-06-06T10:41:06+00:00

I have some drop-down boxes that act as filters on a page. When either

  • 0

I have some drop-down boxes that act as filters on a page. When either one is selected the page reloads and filters the posts based on the selection.

What I’m trying to do, is hide a particular select when the page reloads, if the value is not a blank string (e.g. if someone selects ‘Auckland’, I want that select input to disappear from the page when it reloads, but the other select should stay visible).

Here is the HTML…

<ul>
<li>
    <label style="display:none;">Location:</label>
    <select onchange="this.form.submit();" name="locations" class="filter-dropdown">
        <option value="">SELECT</option>
        <option value="auckland" class="level-0">Auckland</option>
        <option value="tauranga" class="level-0">Tauranga</option>
        <option value="wellington" class="level-0">Wellington</option>
    </select>
</li>
<li>
    <label style="display:none;">Product or service:</label>
    <select onchange="this.form.submit();" name="typeofproduct" class="filter-dropdown">
        <option value="">SELECT</option>
        <option value="clothing" class="level-0">Clothing</option>
        <option value="food" class="level-0">Food</option>
        <option value="shoes" class="level-0">Shoes</option>
        <option value="travel" class="level-0">Travel</option>
    </select>
</li>

And here is my poor attempt at using jQuery…

    jQuery('.filter-dropdown').bind('change', function(event) {

        var x = jQuery(".filter-dropdown option:selected").text();

        if (x == "") {
            jQuery(this).show();
        }
        else{
            jQuery(this).hide();
        }
    });

I’ve tried various this, but the closest I’ve got is the page hiding all the dropdowns (should only be for ones that have been selected. The reason I’m using classes and not ID’s is because there may be more dropdowns on other pages.

  • 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-06T10:41:06+00:00Added an answer on June 6, 2026 at 10:41 am

    It’s not a good feature to hide the user’s selection so not only can’t they see what they selected, but they can’t change it either. Anyway, the following will do the job:

    var element = docment.formName.locations;
    if (element.value != '') {
      element.style.display = 'none';
    }
    

    Substitute the actual name or ID of the form for formName.

    Note that when the page loads, the select will be visible by default so it only needs to be hidden based on its value. Note also that the value will be the value of the first option by default in most browsers unless some other option is set as the default selected option.

    Finally, IE 8 and lower will not behave with the above if the options don’t have a value attribute, so make sure they have one (giving them the same value as their text is good).

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

Sidebar

Related Questions

I have some combo-boxes that are set up as drop down lists, and the
I have a drop down box and some text input fields below it. Based
I have some drop down menus that don't seem to be aligning nicely in
I have 3 drop down boxes, created using the HTML select tag. On page
I have 4 different select boxes (to select one option from drop down). All
I have written some code for displaying a drop down list, but the code
I have a drop down menu which fills with some doc names. Now when
I have a drop down list box like following. Under some condition, in the
I have a multitude of dropdown boxes within my web page. One of these
I have a drop down button named bank. I have 3 text boxes named

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.