比方说,我有...使用jQuery过滤HTML表格
<form action="#">
<fieldset>
to:
<input type="text" name="search" value="" id="to" />
from:
<input type="text" name="search" value="" id="from" />
</fieldset>
</form>
<table border="1">
<tr class="headers">
<th class="bluedata"height="20px" valign="top">63rd St. & Malvern Av. Loop<BR/></th>
<th class="yellowdata"height="20px" valign="top">52nd St. & Lansdowne Av.<BR/></th>
<th class="bluedata"height="20px" valign="top">Lancaster & Girard Avs<BR/></th>
<th class="yellowdata"height="20px" valign="top">40th St. & Lancaster Av.<BR/></th>
<th class="bluedata"height="20px" valign="top">36th & Market Sts<BR/></th>
<th class="yellowdata"height="20px" valign="top">Juniper Station<BR/></th>
</tr>
<tr>
<td class="bluedata"height="20px" title="63rd St. & Malvern Av. Loop">
<table width="100%">
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:47am</td>
</tr>
</table>
</td>
<td class="yellowdata"height="20px" title="52nd St. & Lansdowne Av.">
<table width="100%">
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:47am</td>
</tr>
</table>
</td>
<td class="bluedata"height="20px" title="Lancaster & Girard Avs">
<table width="100%">
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:47am</td>
</tr>
</table>
</td>
<td class="yellowdata"height="20px" title="40th St. & Lancaster Av.">
<table width="100%">
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:47am</td>
</tr>
</table>
</td>
<td class="bluedata"height="20px" title="36th & Market Sts">
<table width="100%">
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:47am</td>
</tr>
</table>
</td>
<td class="bluedata"height="20px" title="Juniper Station">
<table width="100%">
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:17am</td>
</tr>
<tr>
<td>12:47am</td>
</tr>
</table>
</td>
</tr>
</table>
现在取决于什么样的数据输入到文本框,我需要的表TRS/TDS显示或隐藏。
因此,如果我在“to”框中输入63rd,并在“from”框中输入juniper,则只需按照该顺序显示两个trs/tds,而不需要显示其他顺序。
你先试试这个吗?还是你想让我们为你写代码? – 2010-04-28 18:06:57
我不是那个jQuery savy,更多的是一个C#人。我尝试过使用它,而我没有时间去研究所有的东西,所以一个代码示例将非常值得赞赏。 – balexander 2010-04-28 18:08:45
这里是与您的帖子相关的简化版 http://stackoverflow.com/questions/21552714/filter-table-row-in-html – Karthikeyan 2014-02-04 13:27:41