19 lines
755 B
JavaScript
19 lines
755 B
JavaScript
function tableSearch(){
|
|
var table, input, tr, td, row_content;
|
|
table = document.getElementById("tableRooms");
|
|
input = document.getElementById("tableRoomSearch").value.toUpperCase();
|
|
tr = table.getElementsByTagName("tr");
|
|
|
|
for (let i = 0; i < tr.length; i++) {
|
|
td = tr[i].getElementsByTagName("td")[0];
|
|
if(td){
|
|
row_content = td.textContent || td.innerText;
|
|
if (row_content.toUpperCase().indexOf(input) > -1) {
|
|
tr[i].style.display = "";
|
|
}
|
|
else{
|
|
tr[i].style.display ="none";
|
|
}
|
|
}
|
|
}
|
|
} |