Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! ✅Check out the new docs.

JavaScript in dash


I have a simple dash app with an input and a table. I want to filter the table with the input and i have a js code, like this:

function myFunction() {
  var input, filter, table, tr, td, i, txtValue;
  input = document.getElementById("input-table");
  filter = input.value.toUpperCase();
  table = document.getElementById("data-table");
  tr = table.getElementsByTagName("tr");
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[0];
    if (td) {
      txtValue = td.textContent || td.innerText;
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";

how i can call this function when i introduce something in the input filter?