Pixabay/jQuery-autoComplete

step into next input problem

goczen opened this issue · 2 comments

Hi
I have a bug with your autocomplete solution:
I have two input fields and I want to set focus to second field after the first has been selected.
If I use the mouse the first list doesnt close.
Could you check it?

<script> $(function(){

$('input[name="L1"]').autoComplete({
minChars: 0,

source: function(term, suggest){
    term = term.toLowerCase();
    var choices = ['1', '2', '3', '4'];
    var matches = [];
    for (i=0; i<choices.length; i++)
        if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
    suggest(matches);
}, 
onSelect: function(e, term, item){
	$("#L2").val("");
	$("#L2").attr("style", "width:100%;max-width:600px;outline:0");
	$("#L2").focus();
	
}

});

$('input[name="L2"]').autoComplete({
minChars: 0,
source: function(term, suggest){
term = term.toLowerCase();
var choices = ['aaaaa', 'bbbbbb', 'ccccccc', 'dddddd'];
var matches = [];
for (i=0; i<choices.length; i++)
if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
suggest(matches);
}
});

})

In Chrome.

Hello

I am also facing the same problem. Any solution found ?

Regards