Я хочу выполнить прямой поиск по строкам таблицы, используя jQuery, "живое" слово - это ключ, потому что я хочу набирать ключевые слова в текстовом вводе на том же сайте, и мне бы хотелось, чтобы jQuery automaticaly сортировать (или удалять тех, кто не соответствует поисковому запросу) строки таблицы.
Вот мой HTML:
<table>
<tr><th>Unique ID</th><th>Random ID</th></tr>
<tr><td>214215</td><td>442</td></tr>
<tr><td>1252512</td><td>556</td></tr>
<tr><td>2114</td><td>4666</td></tr>
<tr><td>3245466</td><td>334</td></tr>
<tr><td>24111</td><td>54364</td></tr>
</table>
И если бы я был. поиск по Unique ID
, он должен отображать только строки, начинающиеся с определенного числа для уникального идентификатора. Fe. если я введу "2" в поле ввода поиска, следующие строки должны остаться, поскольку они начинаются с 2
:
<table>
<tr><th>Unique ID</th><th>Random ID</th></tr>
<tr><td>214215</td><td>442</td></tr>
<tr><td>2114</td><td>4666</td></tr>
<tr><td>24111</td><td>54364</td></tr>
</table>
Если бы я набрал 24
, тогда должна быть только одна строка, видимая, начиная с 24
:
<table>
<tr><th>Unique ID</th><th>Random ID</th></tr>
<tr><td>24111</td><td>54364</td></tr>
</table>
Если вы, ребята, можете дать мне несколько советов о том, как сделать что-то подобное, я был бы очень благодарен.
Спасибо.