0
I have an input that the user type the filter you want, every keystroke I want to perform a filter, if the typed text contains in the array I want the #div_1 to be displayed otherwise I want the #div_2 to be displayed, can help me?
$('#term').keyup(function(){
var val = $(this).val().toLowerCase();
var elementos = ['japonesa', 'paris 6', 'jundiai'];
if(elementos.indexOf(val) != -1) {
$('#div_1').show();
}else{
$('#div_2').show();
}
});
And what’s the problem? Didn’t it work? Did it make a mistake? Which one?
– Woss