I have a text input search that is supposed to filter divs based on the title of the div. Here is the code that is not working:
$(\'.contact-name\').each(fun
try this
var txt = $('#search-criteria').val();
$('.contact-name:contains("'+txt+'")').show();
documentation for :contains() Selector
fiddle example : http://jsfiddle.net/WBvTj/2/
UPDATE CASE INSENSITIVE:
var txt = $('#search-criteria').val();
$('.contact-name').each(function(){
if($(this).text().toUpperCase().indexOf(txt.toUpperCase()) != -1){
$(this).show();
}
});
fiddle Example : http://jsfiddle.net/WBvTj/4/