Hi all,
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 guessing this is because options within a select list are not hide-able.
<script type="text/javascript">
$(document).ready(function() {
$("#inputFilter").change(function() {
var filter = $(this).val();
$("#selectList option").each(function() {
var match = $(this).text().search(new RegExp(filter, "i"));
if (match > 0) {
$(this).show(); // Does not work
}
else
$(this).hide();
});
});
});
</script>
and here's my html
<input id="inputFilter" />
<select id="selectList">
<option value="1111" >1111 - London</option>
<option value="1112" >1112 - Paris </option>
</select>