我想对具有“可搜索”类的 div 执行搜索,但我不确定应该如何选择它。我之前尝试过类似代码的东西,但它没有用。
$('#SEARCH').change(function () {
//if (e.which == 13) {
var txt = $('#SEARCH').val();
$('.divin').each(function(){
if($(this + ' > .searchable').text().toUpperCase().indexOf(txt.toUpperCase()) == -1){
$(this).hide();
}
});
//}
});
($(this + ' > .searchable')不正确
HTML:
<li id="listItem_156" class="divin">
<div style="width:30px;">
<a href="#?w=800" rel="popup_name" id="156" class="poplight">
<img height="16" style="cursor:move;" width="16" src="img/arrow.png" border="0" />
</a>
</div>
<div style="width:220px;" class="searchable">
<a href="action=MemberDetails&item=156" class="body">Mike Frank </a>
</div>
<div style="width:110px;">
0
</div>