Waqas Adil Waqas Adil - 11 months ago 58
Javascript Question

how to make two segregate searches for two different tables using jquery

Two tables with two different search:

image

I have two tables Table 1 and Table 2 with two search options.

when i search in table 1 it retrieve data from table 2 .and when i search in table 2 then it also retrieve from table 1.

how we can segregate each search only for regarding specific table.

this link has only one search but i need two segregate search for two different tables in one div tag.

i have copied this code from that link.
Sorry for Poor English.Thanks In advance.

Answer Source

You would need to make some refactor from your codepen, basically you would need to set a unique selector instead of using .search and .table for each input. I made a fork of your pen were I encapsulate a function that will receive a search selector and a table selector and will add the events to those selectors. It was a fast sketch so it can be improved a lot.

codepen