Like the title states, I'm using the same code for both functions like so
function autoComplete() {
var jarName = $("#artifactId").val();
var jarVersion = $("#version").val();
url = "/xx/yy/zz/"+jarName+"/"+jarVersion+"";
if (jarVersion===""){
url = "/api/eetools/appdependencyfinder/"+jarName+"";
}
$.getJSON(url, function(completion) {
$("#version").autocomplete({
source: completion,
minLength: 0
})
.focus(function() {
$(this).autocomplete('search', $(this).val())
});
});
}
$("#version").on('keyup',autoComplete);
$("#version").on('click',autoComplete);
I modified my autocomplete from here
I wanted to on click, show all possible options.
And on click it seems to work for everyone in the question that I've linked with the function I've created. However when I click it doesn't work. IF I click, move off the screen to a new tab, then come back, it does work. or IF I click on the field, click off of it, then click on it again. Can you see a reason for this type of behavior?
It's almost like it takes 1 click to register, then on the second it works.
I tried deleting the on('click') function and test keyup, and noticed that now 'keyup' takes 2 keyups to work
After putting console.log(completion) inside the callback and console.log(“HERE”) inside the focus call I saw on the log that completion will print multiple times but not HERE, and if I switch off the screen then back on HERE will inject itself in between the completion prints.