I was wondering if i could get some help with filtering a select list using an input box via jquery.
Here\'s what my js looks like, but it doesnt seem to work. I\'m gues
Please try this:
$("#inputFilter").change(function() {
var filter = $(this).val();
//alert(filter);
$("#selectList option").each(function() {
var match = $(this).text().search(new RegExp(filter, "i"));
//alert(match);
if (match < 0 && $(this).text() != "--select--") {
$(this).attr("disabled",true);
}
else
$(this).attr("disabled",false);
});
});
You can see it in action here.
HTH