<input type="text" id="searchInput" placeholder="ค้นหา...">
<script>
function filterTable() {
const input = document.getElementById("searchInput");
const filter = input.value.toUpperCase();
const table = document.querySelector("table");
const rows = table.getElementsByTagName("tr");
for (let i = 1; i < rows.length; i++) { // เริ่มจากแถวที่ 1 เพื่อข้ามหัวคอลัมน์
const cells = rows[i].getElementsByTagName("td");
let found = false;
for (let j = 0; j < cells.length; j++) {
if (cells[j].textContent.toUpperCase().indexOf(filter) > -1) {
found = true;
break;
}
}
rows[i].style.display = found ? "" : "none";
}
}
document.getElementById("searchInput").addEventListener("input", filterTable);
</script>
To embed this project on your website, copy the following code and paste it into your website's HTML: