Edit. My previous question was difficult to understand, so I will now try to clarify.
The code given below works fine for searching a table. There is a
single input box (id=”name”) in the html part, the table, then the code:
$(document).ready(function() {
$("#name").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#data_table tr").filter(function() {
$(this).toggle($(this).text()
.toLowerCase().indexOf(value) > -1)
});
});
});
I have added two input boxes, (id =”strain” and id=”acc”), and
corresponding thead entries to give 3 columns. The tbody is now:
Alive-to-die P301 CP123
Michael Herdman U123 AP456
Michael Herdman C567 AP
Michael Herdman P511 AP789
I have changed the above code to make it capable of searching all columns:
$(“#name,#strain,#acc”).on(“keyup”, function()
This works, searching for “c” in the accession search box correctly shows
only the 1st row, and “m” in the name search returns the last 3 rows.
However, using the two terms simultaneously returns the first row; it
should give an empty table, since no line contains both. Similar results
are obtained when both name and strain columns are searched.
Can the code be changed to permit this kind of simultaneous searching?