-2
The idea is to make a filter.
I have a text field that the user types what they want to filter, so I store the typed words in an array. Ex.: The user typed in the "config company" field, the array looks like this:
arrayBusca = ['config', 'empresa']
I need to filter the list so it displays only items it contains BOTH array items. If the user type "company config" must display the record "Company setup" and hide the others as "Company" or "General settings".
So far I did this, but it doesn’t work because it displays other records that contains only the word "Config" and others that only contains "company"
var arrayBusca = busca.split(" ");
for(x in searchArray){
menusFiltrados = $('.texto:contains(\'' + arrayBusca[x].trim() + '\')')
}
Very good! That’s what I needed, I repeated the question in the English OS if you want to take a look! https://stackoverflow.com/questions/67403462/how-to-filter-a-list-using-an-array-of-keywords/67403493?noredirect=1#comment119142363_67403493
– ARTHUR KRAEMER