
I have an html page in crm form with a dynamic input text element.
Below is the code for autocomplete functionality:
function Test(span) {
debugger;
var ID = span.id;
// array with unique values
var uniqueNames = [];
$.each(Names, function (i, el) {
if ($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});
// sort array alphabetically
uniqueNames.sort();
$("#" + ID).autocomplete({
source: function (request, response) {
var matches = $.map(uniqueNames, function (uniqueNames) {
if (uniqueNames.toUpperCase().indexOf(request.term.toUpperCase()) === 0) {
return uniqueNames;
}
});
response(matches);
},
minLength: 0,
change: function (event, ui) {
update_field(span);
},
delay: 0,
type: Array
}).click(function () {
$(this).autocomplete('search', $(this).val())
});
}
On first click on textbox autocomplete functionality not working but working fine on 2nd click.
*This post is locked for comments
I have the same question (0)Hi,
I would post this in a jquery/javascript forum as it's not really CRM related other than being a web resource on a page.