Messages de MrSolutionCode

<input type="text" id="myInput" onkeyup="filterFunction()" placeholder="...">
<table id="myTable">
<tr class="header">
<th style="width:60%;">t1</th>
<th style="width:40%;">t2</th>
<th style="width:40%;">t3</th>
<th style="width:40%;">t4</th>
<th style="width:40%;">t5</th>
</tr>
<tr>
<td>bleu</td>
<td>ok test</td>
</tr>
<tr>
<td>rouge</td>
<td>non pas test</td>
</tr>



</table>

<script>
function filterFunction() {
var src, input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase().trim().split(' ');
table = document.getElementById("myTable");
for (j = 0; j < filter.length; j++) {
tr = table.getElementsByTagName("tr");
src = filter[j].trim();
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
td2 = tr[i].getElementsByTagName("td")[1];
if (src!='' && td && td2) {
txtValue = td.textContent || td.innerText;
txtValue2 = td2.textContent || td2.innerText;
if (txtValue.toUpperCase().indexOf(src) > -1 || txtValue2.toUpperCase().indexOf(src) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
}

</script>