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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:30:37+00:00 2026-06-04T06:30:37+00:00

I am having two issues with my JS code here and any help is

  • 0

I am having two issues with my JS code here and any help is greatly appreciated …

  1. I need to add a logic so that the “Over 50” options is displayed in the filtering list when there’s a product priced say $499. with my current implementation this is not working.

    <li>
        <!-- over 50 product is not showing when filtering -->
        <a href="/product-three">Product Four</a><br>
        <span id="lowestPriceRange">400</span>
        <span id="highestPriceRange">400</span>
    </li>
    
    
    // Because I need to handle it here somehow but I'm stuck
    var hidePrices = {};
    hidePrices[0] = true;
    hidePrices[10] = true;
    hidePrices[20] = true;
    hidePrices[30] = true;
    hidePrices[40] = true;
    hidePrices[50] = true;
    
    $('#products').find('span').each(function(i, el){
        var key = parseInt(Math.floor($(this).html() / 10) * 10, 10);
        hidePrices[key] = false;
    });
    
    $('#filterByPrice').find('li').each(function(i, el){
        if (hidePrices[Number($(this).find('a').attr('name'))]) {
            $(this).hide();
        }
    });
    
  2. It’s hiding some products that I want to display. For example, I want to show a product priced between $40 – $60 when the $40 – $50 filtering option is selected.

  • 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-04T06:30:38+00:00Added an answer on June 4, 2026 at 6:30 am

    Here I fixed your issues: http://jsfiddle.net/qNFWM/7/

    To fix the first issue I added this because your key was 400:

    if (key > 50) key = 50;
    

    To fix the second issue I changed this:

    return (minProductPrice >= minSelectedPrice && maxProductPrice <= maxSelectedPrice);
    

    To this:

    return ((minProductPrice >= minSelectedPrice &&  minProductPrice <= maxSelectedPrice) || (maxProductPrice >= minSelectedPrice &&  maxProductPrice <= maxSelectedPrice));
    

    So that only the min or the max had to be in the range.

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

Sidebar

Related Questions

I am having two issues with my code - I am not sure how
I am having two issues: I usually create separate view for the login to
I having two arrays say, $array1 = array(code => E0089, desc => some description);
We are having two load balancing server. In that we have hosted a asp.net
I'm having two jquery's that I run and I want to combine them both
I'm having an issue with two jQuery calls. The first is a load that
I having issues exporting a GridView to Excel for some reason. I have two
I've inherited some C# code and need to port it to PHP. Here it
I seem to be having issues. I have a query string that has values
Having some problems with a piece of Jquery code, well that's where I think

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.