Jump to content

Elka74100

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Elka74100

  • Rank
    Newbie
  1. CSS Javascript Filters Table

    Thank you so much guys
  2. CSS Javascript Filters Table

    Hi Guys, I am using the CSS Javascript filter table which is posted on W3 website : https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_filters_table It works well but searches only in the first column of the table and I would like it searches in both. If someone could give me the solution I would really appreciate that. Thank you very much in advance. PS: The code function myFunction() { var input, filter, table, tr, td, i; input = document.getElementById("myInput"); filter = input.value.toUpperCase(); table = document.getElementById("myTable"); tr = table.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { td = tr.getElementsByTagName("td")[0]; if (td) { if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { tr.style.display = ""; } else { tr.style.display = "none"; } } } }
×