Advertisement
Onesible

Untitled

Mar 20th, 2025
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve() {
  2.    document.querySelectorAll(".select").forEach(el => el.classList.remove("select"));
  3.  
  4.    let searchFields = document.querySelectorAll("tbody tr");
  5.    let searchText = document.getElementById("searchField");
  6.  
  7.    if (!searchText.value.trim()) {
  8.       searchText.value = '';
  9.       return;
  10.    }
  11.  
  12.    for (let field of searchFields) {
  13.       if (field.textContent.toLowerCase().includes(searchText.value.toLowerCase())) {
  14.          field.classList.add("select");
  15.       }
  16.    }
  17.  
  18.    searchText.value = '';
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement