I have an array of items that I'd like the user to be able to filter through in using multiple drop-down lists. In this case, each character for the strings has its own filter.
My question is how can I filter my array once it's already been filtered? i.e. my array, parts, ["35X", "45X" "35L"], if I've already filtered down to strings containing '3', how can I filter down to strings containing 3 and L?
var parts = [" 35X", " 35L", " X44", " 55L", " 55X"];
var obj8 = document.getElementById("selectOperators");
var obj1 = document.getElementById("Series");
function getOption1() {
var din = filterParts(obj1.options[obj1.selectedIndex].value)
document.getElementById("other").innerHTML = din;
}
function getOption8() {
var ryan = filterParts(obj8.options[obj8.selectedIndex].value)
document.getElementById("other").innerHTML = ryan;
}
function filterParts(query) {
return parts.filter((el) => el.toLowerCase().indexOf(query.toLowerCase()) > -1)
}
If possible to do so without the use of jquery