Dealing with Jquery-UI autocomplete widget click event behaviour

Dealing with Jquery-UI autocomplete widget click event behaviour

Last updated:

Ok if you've used JQuery UI's autocomplete plugin, you'll have probably noticed that it doesn't behave as you would expect when you click on an item on the generated autocomplete list rather than browse with the keyboard.

Some things just don't work when you click on an item as opposed to browse to it (using up and down keyboard keys) and hit enter.

function(event,ui){
    $("#MapVulnerabilityForm_name").val(ui.item.value);
    $("#MapVulnerabilityForm_name").keyup();
}

What I've done here is the following: I've captured the value of the item that got clicked on and passed it onto another input and then triggered an event on it.

If you have ever come across this, you'll know what I mean...

Dialogue & Discussion