I have a select field with a redirect that works okay, however, the selection will have over 100+ items so I'd like to give it an autocomplete feature as well. I've tried several solutions but can't get them to work. I haven't used Jquery for years and my skills are seriously lacking.
So far I have the following, which works great, now I would just like to add an autocomplete to it for the user's benefit, any help would be much appreciated.
HTML
<select class="uk-select" id="occupation_select">
<option value="" selected>Select Occupation</option>
<option value="/avon">Avon</option>
<option value="/amway">Amway</option>
<option value="/body-shop">Body Shop</option>
</select>
<script>
$(function(){
// bind change event to select
$('#occupation_select').on('change', function () {
var url = $(this).val(); // get selected value
if (url) { // require a URL
window.location = url; // redirect
}
return false;
});
});
</script>