I want to show only divs that contains the entered search values.
So if I type upload login
in the Searchbox it should show only Question 1 and Question 3.
Note: It should work with multiple search input values(like in the example: should search for value upload
AND login
and show the divs which contains this values).
Note 2: It should also show Question 1 and Question 3 if the search input is like this: upl log
Note 3: Not case sensitiv. So upload
should filter the div(Question 1) with content Upload
.
This is what i got:
<section id="content">
<div id="search-block">
<input type="text" id="inpSearch" placeholder="Search.." />
</div>
<div>
<div class="wrapper">
<h1>Question 1</h1>
<p>Harry Markus Upload</p>
</div>
</div>
<div>
<div class="wrapper">
<h1>Question 2</h1>
<p>Registration Append August Download</p>
</div>
</div>
<div>
<div class="wrapper">
<h1>Question 3</h1>
<p>Login July Dad</p>
</div>
</div>
$('#inpSearch').keyup(function(){
var sSearch = this.value;
$('section#content > div:not(:first-child)').hide();
$('section#content > div:contains("' + sSearch + '"):not(:first-child)').show();
});