I am trying to create a “jquery search function” and I want to be able to use more than one word to sort the results.
Can someone please show me how to make it work?
This is what I got:
$(document).ready(function(){
$('.qid').keyup(function() {
var keyword = $(this).val().toLowerCase().split(" ");
$(".q").removeClass('show');
$(".q:contains('"+ keyword[0] +"'):contains('"+ keyword[1] +"'):contains('"+ keyword[2] +"'):contains('"+ keyword[3] +"')").addClass('show');
if ($('.qid').val() == '')
{
$('.q').removeClass('show');
}
});
});