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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:42:22+00:00 2026-05-30T16:42:22+00:00

I’m trying to filter results based on what a user selects in a select

  • 0

I’m trying to filter results based on what a user selects in a select form. Here is my HTML:

<li>
Colour Options
<select name="item_options[cf_product_option_colour]" id="product-multiple-1">
    <option>Choose Option</option>
    <option value="Red">Red</option>
    <option value="Green">Green</option>
    <option value="Blue">Blue</option>
</select>
</li>
<li>
Size Options
<select name="item_options[cf_product_option_size]" id="product-multiple-2">
    <option>Choose Option</option>
    <option value="75643" class="Red">5ml - £1.00</option>
    <option value="765432" class="Red">10ml - £2.00</option>
    <option value="867564534" class="Red">15ml - £3.00</option>
    <option value="5434" class="Red">20ml - £4.00</option>
    <option value="6453234" class="Green">5ml - £1.00</option>
    <option value="45256536" class="Green">10ml - £2.00</option>
    <option value="52454" class="Green">15ml - £3.00</option>
    <option value="6543754" class="Blue">5ml - £1.00</option>
    <option value="4316243" class="Blue">10ml - £2.00</option>
</select>
</li>

And the jQuery:

$("#product-multiple-1").change(function(){
    var matches = $("#product-multiple-2 > option." + $(this).val());
    $("#product-multiple-2").empty().html(matches);
    console.log(matches);
    return matches;
});

What should happen, is when I choose a colour option, it changes the size options drop down. This seems to work when I choose the first colour option, but then if I choose another colour option, it doesn’t do anything.

I inspected it and looked at the console. It seems to run the variable once, but then when I try select another option, the variable is blank and in console it just displays []

Any help would be good 🙂

  • 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-30T16:42:23+00:00Added an answer on May 30, 2026 at 4:42 pm

    The problem is, when you replace the options the first time , the only options in the second select have the class of the first color and all the other color classes are gone. If I click on RED first, get red class in second. Now click on GREEN and it returns no match so the select gets emptied.

    A simple fix would be cache a clone of the options.

    var $options= $('#product-multiple-2 option');
    $("#product-multiple-1").change(function(){
        var matches = $options.filter('.'+$(this).val()).clone();
        $("#product-multiple-2").html(matches);
    });
    

    Now you can go back to the well as often as needed . Trying to hide options does not work in IE

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from

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.