var search_input = $('#input_search');
var search_console = search_input.val();
var header_console = $('.header');
$('#enter_console').click(function() {
var bodies = $('.reviews');
for(var i=0;i<bodies.length;i++){
var bodies = bodies[i];
if($(bodies).find(header_console).filter(':contains("+search_console+")')) {
bodies[i].hide();
}
}
});
我正在尝试查找正文是否包含用户在输入中输入的单词。然后,如果那个机构有这个词隐藏除它之外的其余元素。谁能帮我???基本的 html 看起来像
<div id="2343" class="reviews">
<h2>Animal Crossing: City Folk</h2><h3 class="header">Wii</h3>
<p>8/10</p>
<img src="http://i1231.photobucket.com/albums/ee512/Rukiafan23/1_zpsdab192dc.jpg" alt="{title}">
<a href="http://www.wiiwarewave.com/t93-animal-crossing-city-folk">
Read this Review
</a>
<div class="inner_box_review">----</div>
</div>