I asked a question about live searching a table but I have multiple fields like text and select dropdown fields. I wrote a js code based on the answer I got from my previous question:

$("#deviceName").keyup(function(){ var deviceNameFilter = $(this).val(); $("#device-list_table tbody tr").each(function(){ if ($(this).text().search(new RegExp(deviceNameFilter, "i")) < 0) { $(this).hide(); } else { $(this).show(); } }); }); $("#broadcastProg").change(function(){ var broadcastProgFilter = $("#broadcastProg option:selected").text(); $("#device-list_table tbody tr").each(function(){ if ($(this).text().search(new RegExp(broadcastProgFilter, "i")) < 0) { $(this).hide(); } else { $(this).show(); } }); }); $("#store").change(function(){ var storeFilter = $("#store option:selected").text(); $("#device-list_table tbody tr").each(function(){ if ($(this).text().search(new RegExp(storeFilter, "i")) < 0) { $(this).hide(); } else { $(this).show(); } }); }); $("#deviceModel").change(function(){ var deviceModelFilter = $("#deviceModel option:selected").text(); $("#device-list_table tbody tr").each(function(){ if ($(this).text().search(new RegExp(deviceModelFilter, "i")) < 0) { $(this).hide(); } else { $(this).show(); } }); }); $("#deviceStatus").change(function(){ var deviceStatusFilter = $("#deviceStatus option:selected").text(); $("#device-list_table tbody tr").each(function(){ if ($(this).text().search(new RegExp(deviceStatusFilter, "i")) < 0) { $(this).hide(); } else { $(this).show(); } }); }); $("#logOutputLog").keyup(function(){ var logOutputLogFilter = $(this).val(); $("#device-list_table tbody tr").each(function(){ if ($(this).text().search(new RegExp(logOutputLogFilter, "i")) < 0) { $(this).hide(); } else { $(this).show(); } }); });

For example, I input keywords on deviceName field, the table updates and displays the results, but when I select an option from broadcastProg dropdown field, it also displays the results but only results from the selected option without considering deviceName field's results. So it should be that, say when I input "iPhone" perhaps in deviceName text field and choose "Schedule 1" in broadcastProg dropdown field, then the table should display the rows with "iPhone" under Device Name column and "Schedule 1" under Broadcasted Program column. How do I merge the results then?

Also, deviceName field should only search Device Name column, excluding other columns. In my case, it searches all the columns.

Hope someone can help out.