How Can I Filter My Searchresults With Multiple Filters? (dropdown, Keywords Etc)
I have a Codeigniter website with a searchfunction. I am able to search on postal code and a keyword. Now I would like to have searchfilters on my 'searchresults' page to narrow th
Solution 1:
Here is the simple example i have created for you hope it gives you the idea that you are trying to implement
Consider this html that contains the ul li structure with two search fields
<ul>
<li>bob bope</li>
<li>bob test</li>
<li>bob bones</li>
<li>bob bobs</li>
<li>test mcBridge</li>
</ul>
<br>
Search: <input id="search" class="search" length="24" />
Refine <input id="refine" class="search" length="24" />
And here is the jquery which searches as well as refines the results considering the values of both text fields
$(document).ready(function(){
$(".search").keyup(function(){
$("li").hide();
if($("#refine").val()!=""){
var term = $("#search").val()+" "+$("#refine").val();
}else{
var term =$("#search").val();
}
$("li:contains('" + term + "')").show();
});
});
I hope this what you were looking for , for testing write bob in first field then write test in other field you will see only one result
Post a Comment for "How Can I Filter My Searchresults With Multiple Filters? (dropdown, Keywords Etc)"