Exact online match client name and auto check checkboxes

By.

min read

My profile

Share this:
const searchTerm = "clientname";

document.querySelectorAll("tr").forEach(row => {
  const cells = row.querySelectorAll("td");
  const matches = [...cells].some(td =>
    td.textContent.toLowerCase().includes(searchTerm.toLowerCase())
  );

  if (matches) {
    const checkbox = row.querySelector("input[type='checkbox']");
    if (checkbox) {
      checkbox.checked = true;
      console.log("Checked row:", row.textContent.trim().substring(0, 80));
    }
  }
});
Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *