[jQuery] Autocomplete plugin onclick event
Hi,
I'm trying to use the Autocomplete plugin from http://docs.jquery.com/Plugins/Autocomplete
in a pseudo select box. I'd like the suggestions to appear when the
user clicks on the appropriate arrow.
$('#input').autocomplete(['0','1','2','3','4','5','6','7','8','9'],
{ minChars: 0 });
$('#input').click(function() { $(this).trigger("select") });
$('#input_btn').click(function() {
$(this).prev('input').val('1').trigger('focus').trigger('keydown');
});
It works only if I assign the first character and it is included in
the autocomplete list (see val(1) above).
If I set val('') the autocomplete box doesn't appear, yet if I
consequently press arrow down once the focus is in the input, it does.
I also tried the following to no avail:
e = jQuery.Event('keydown');
e.which = 40;
$('input').trigger(e);
Thanks