Search bar in table in wordpress

I used this code in the table plugin. It checks data through only one column, I want the code to use all columns.const

I used this code in the table plugin. It checks data through only one column, I want the code to use all columns.

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";
        }
    }
}
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742266980a4411982.html

相关推荐

  • Search bar in table in wordpress

    I used this code in the table plugin. It checks data through only one column, I want the code to use all columns.const

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信