Search bar in table in wordpress

Question

i used this code in table ,plugin. it checks data through only one column , i want it code use all columns. Anyone can help me plz?

const searchFun = () =>{
let filter =document.getElementById(‘myInput’).value.toUpperCase();
let myTable = document.getElementById(‘myTable’);
let tr = myTable.getElementsByTagName(‘tr’);
for(var i=0; i<tr.length; i++){
let td = tr[i].getElementsByTagName(‘td’)[0];

         if(td){
             let textvlaue = td.textContent || td.innerHTML;
             if(textvlaue.toUpperCase().indexOf(filter)>-1){
                 tr[i].style.display = "";
             }else{
                 tr[i].style.display="none";
             }
         }
     }
     
     
 } 
0
, Arshpreet Venveru 1 year 2020-07-13T05:10:37-05:00 0 Answers 55 views 0

Leave an answer

Browse
Browse