I'm not sure if there is a better way to accomplish this, however I have a ul that I am filtering on the data-type value of each li element. This works fine for one filter since it starts as a ul object and then returns an array, or array-like of the correct li elements, however .find does not seem to work of the array of objects, only the single ul object. If there is an easy way to convert the li objects back to a single object for the second filter, or perhaps there is a better way to filter the array of li on the data-type value. Thank you in advance.
Edit: The entire code is too long to post here, however, $data = $('#records');
is what gives me the ul and then var $filteredData = $data.find('li[data-type*= ' + $($filterType1+":checked").val() + ' ]');
is what correctly gives me the first filtered records.
With just this, I get an array of 24 items after the first filter, but then zero with a second filter even though there should be more than one. To test, I then didn't filter but just got every li with find and tried running the first filter over that array and it failed the same. So it appears as if .find cannot be run over an array.
This works:
$data = $('#records');
var $filteredData = $data.find('li[data-type*= ' + $($filterType1+":checked").val() + ' ]');
These both fail:
$data = $('#records');
var $filteredData = $data.find('li[data-type*= ' + $($filterType1+":checked").val() + ' ]');
$filteredData = $filteredData.find('li[data-type*= ' + $($filterType2+":checked").val() + ' ]');
$data = $('#records');
var $filteredData = $data.find('li');
$filteredData = $filteredData.find('li[data-type*= ' + $($filterType1+":checked").val() + ' ]');