I have a unique div
setup where I'm defining data attributes to display a product list. Each div
contains data attributes for category (data-category
) and price (data-price
). I want to be able to show or hide specific div
s based on selections made using checkboxes for category and price. Below is the structure of the HTML:
<div class="content" data-category="shoes" data-price="1000">shoe1</div><br />
<div class="content" data-category="shirts" data-price="1200">shirt1</div><br />
<div class="content" data-category="shoes" data-price="2000">shoe2</div><br />
<div class="content" data-category="shoes" data-price="800">shoe3</div><br />
<div class="content" data-category="shirts" data-price="1300">shirt2</div><br />
<div class="content" data-category="shirts" data-price="800">shirt3</div><br />
<input type="checkbox" class="category" category="shoes" id="shoes">shoes
<input type="checkbox" class="category" category="shirts" id="shirts">shirts
Currently, I have checkboxes set up for selecting categories, but I'm struggling with implementing a range jQuery slider for selecting prices. Ideally, when a user selects a category checkbox (e.g. shoes), only the corresponding div
elements should be displayed. Then, if the user applies a price filter within a specified range, only the div
elements falling within that range should be displayed.
For instance: If "shoes" is selected, only shoe div
s should be shown. If a price range of 1000-2000 is applied, then only shoe1
and shoe2
should be displayed, excluding shoe3
. Any assistance with this would be greatly appreciated.