Filter table rows with jquery

前端 未结 3 1992
执念已碎
执念已碎 2021-01-07 23:07

I would like to know how to filter table rows based on a column value. Plugins excluded, I would like to figure it out how to make this thing to work.

3条回答
  •  不要未来只要你来
    2021-01-07 23:40

    The basic idea behind all table-filtering is to hide all rows and then show those where the content of a has the searchstring included.

    With jQuery the magic is done like this:

    $('tr').filter(":contains('" + searchstring + "')").show();
    

    But there's no need to use jQuery for this - I've coded a plain JS-solution for it. You can find it here.

提交回复
热议问题