I want to filter the following jQuery Autocomplete function so that the search/filtering should be done from the beginning of the word only.
here's the search code im working with
if ($('#search_placeholder_l').length > 0) {
$('#search_placeholder_l')
.autocomplete({
source: '/test/get_xs?check_enable_ys=false',
minLength: 3,
response: function(event, ui) {
if (ui.content.length == 1) {
ui.item = ui.content[0];
$(this)
.data('ui-autocomplete')
._trigger('select', 'autocompleteselect', ui);
$(this).autocomplete('close');
} else if (ui.content.length == 0) {
swal(LANG.no_products_found);
}
},
select: function(event, ui) {
$(this).val(null);
get_l_placeholder_row(ui.item.pl_id, ui.item.vl_id);
},
})
.autocomplete('instance')._renderItem = function(ul, item) {
return $('<li>')
.append('<div>' + item.text + '</div>')
.appendTo(ul);
};
}