JavaScript How to add second level filtering to filtered results using PHP, JS

I have a page on my site where a user can select boxes to return a query based on their selection. For example, my header looks like:

_Burgers _Fries _Beverage _small _medium _large

The first row is working great, if a user selects Burgers, it returns only Burger meals, If they select Burgers and Beverage it returns only the meals that have a Burger and Beverage, etc.

If, for example, the page looks like:

X Burgers X Fries _ Beverage _small _medium _large

It is returning:

Burger & Fries Meal Combo #1 (small) Burger & Fries Meal Combo #1 (medium) Burger & Fries Meal Combo #1 (large) Burger & Fries Meal Combo #2 (small) Burger & Fries Meal Combo #2 (medium) Burger & Fries Meal Combo #2 (large)

The issue I am having is figuring out how to add the second level of filters so that if a user selects "small", it only returns the small combo options.

I am using the MODX CMS, so my landing page has the following code (the [[whatever]] is just the query to the database to return results in that div):

<div class="combo-hide-me" id="default">[[!comboLanding? &filter=`default`]]</div>
<div class="combo-hide-me" id="burger_div_id" style="display: none;">[[!comboLanding? &filter=`b`]]</div>
<div class="combo-hide-me" id="fries_div_id" style="display: none;">[[!comboLanding? &filter=`f`]]</div>
<div class="combo-hide-me" id="beverage_div_id" style="display: none;">[[!comboLanding? &filter=`b`]]</div>
<div class="combo-hide-me" id="beveragefries_div_id" style="display: none;">[[!comboLanding? &filter=`bf`]]</div>
etc..

My javascript looks like:

// combo checkbox selction
$(document).ready(function () {
packageOutput();
});

function packageOutput() {

// set the main div to return filtered results
var packageDiv = $(".plans-container");

// set empty array
var idArr = [];

// get the checked values
var checked = $(".active");

// loop and build array
checked.each(function () {
    idArr.push($(this).prop("id"));
});

// remove whitespace in array
var trimArray = idArr.join("");

// function below    
toggleShowHide(trimArray, packageDiv);
}

function toggleShowHide(arr, elem) {

// determine if there are boxes checked
var arrLen = arr.length;

// clear last selected item
$(".combo-hide-me").hide();

// set default if array is empty
if (arrLen < 1 ){

    //function below
    setDefault(elem);
}

// run the show hide based on array of selection
for(i = 0; i < arrLen; i++) {

    // set the div name from array
    var temp = "#" + arr + "_div_id";

    $(temp).show();
    $("#default").hide();
} 

// unhide
elem.show();
}

function setDefault(elem){
$("#default").show();
}

Thank you in advance for any guidance you can provide in getting the second level filters working.

EDIT: I just realized I did not add my code for the select boxes for small, medium, large:

<div class="sizes" id="size_div_id">
<h4>Combo Sizes:</h4>
  <div class="checks">

    <div class="selection">
      <input type="checkbox" id="small" name="combosize">
      <label for="small"><span></span>Small</label>
    </div>

    <div class="selection">
      <input type="checkbox" id="medium" name="combosize">
      <label for="medium"><span></span>Medium</label>
    </div>

    <div class="selection">
      <input type="checkbox" id="large" name="combosize">
      <label for="large"><span></span>Large</label>
    </div>

  </div>
</div>
Answer:1

I am trying to build an extremely simple responsive navigation menu. Am having some problems here. When I resize the window equal to or lower than 768px in width, the responsive menu will not work. ...

I am trying to build an extremely simple responsive navigation menu. Am having some problems here. When I resize the window equal to or lower than 768px in width, the responsive menu will not work. ...

  1. responsive navigation menu css codepen
  2. responsive navigation menu css
  3. responsive navigation menu jquery
  4. responsive navigation menu bootstrap
  5. responsive navigation menu jquery codepen
  6. responsive navigation menu css free download
  7. responsive navigation menu codepen
  8. responsive navigation menu with submenu
  9. responsive navigation menu with dropdown
  10. responsive navigation menu css jquery
  11. responsive navigation menu examples
  12. responsive navigation menu template
  13. responsive navigation menu css examples
  14. responsive navigation menu bootstrap codepen
  15. responsive navigation menu css only
  16. responsive navigation menu bootstrap free download
  17. responsive navigation menu with submenu bootstrap
  18. responsive navigation menu css bootstrap
  19. responsive navigation menu css code
  20. responsive navigation menu bootstrap 4

So I have a table that I am sorting using the jQuery plugin tablersorter (tablesorter.com). there are two headers in my table that I do not want to be able to sort by and am trying to disable. I used ...

So I have a table that I am sorting using the jQuery plugin tablersorter (tablesorter.com). there are two headers in my table that I do not want to be able to sort by and am trying to disable. I used ...

  1. jquery tablesorter plugin
  2. jquery tablesorter plugin download
  3. jquery.tablesorter.js plugin download
  4. jquery tablesorter plugin example
  5. jquery tablesorter pager plugin
  6. jquery.tablesorter.pager.js plugin
  7. jquery.tablesorter.min.js plugin
  8. jquery plugin tablesorter 2.0

i have table <table width="100%" border="0" cellspacing="0" cellpadding="0" class="activity_tab"> <tr id="list_1"> <td><span class="new_act">Folder files Created&...

i have table <table width="100%" border="0" cellspacing="0" cellpadding="0" class="activity_tab"> <tr id="list_1"> <td><span class="new_act">Folder files Created&...

  1. class selected table

i have a base class function Base(){ this.children = new Array(); } Base.prototype.Add = function(child){ this.children.push(child) } function Sub1(){...} Sub1.prototype = new Base(); ...

i have a base class function Base(){ this.children = new Array(); } Base.prototype.Add = function(child){ this.children.push(child) } function Sub1(){...} Sub1.prototype = new Base(); ...

  1. how does this javascript work
  2. does javascript have classes
  3. does javascript need semicolons
  4. does javascript pass by reference
  5. does javascript require semicolons
  6. does javascript support automatic type conversion
  7. does javascript allow exception handling
  8. does javascript have garbage collection
  9. does javascript support inheritance
  10. does javascript have interfaces
  11. does javascript compile
  12. does javascript have pointers
  13. does javascript have dictionaries
  14. does javascript have inheritance
  15. does javascript alert stop execution
  16. does javascript support multithreading
  17. does javascript cost money
  18. does javascript work on iphone
  19. does javascript map preserve order
  20. does javascript support multiple inheritance