次のような標準のHTMLテーブル構造があると仮定します。
<table class="table table-striped table-hover table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Added</th>
</tr>
</thead>
<tbody>
<tr id="1a0daa2734" class="item">
<td><a href="/view/1a0daa2734">Item Number 1</a></td>
<td>A</td>
<td>8/1/2012 10:18:34 PM</td>
</tr>
<tr id="b1ff6e0ac" class="item">
<td><a href="/view/b1ff6e0ac">Item Number 2</a></td>
<td>B</td>
<td>8/2/2012 5:48:54 PM</td>
</tr>
<tr id="edd8b70893" class="item">
<td><a href="/view/edd8b70893">Item Number 3</a></td>
<td>A</td>
<td>8/13/2012 3:55:41 PM</td>
</tr>
</tbody>
</table>
jQueryを使用してクライアント側の検索を作成しようとしています。基本的に、IDが。の検索ボックスがありsearch-items
ます。
$("#search-items").bind("keyup paste", function() {
var searchText = $("#search-items").val();
$(".item").each(function() {
//???
});
});
tbody内のNON-MATCHESsearch-items
の検索値を取得し、見つけるための最良の方法は何ですか?それらは私が隠す要素であるため、私は不一致が欲しいです。
td
最初の2つの要素内のみを検索する必要があるため、name
およびtype
列は追加されません。
ありがとう。