[jQuery] [Autocomplete] result accompanied with blur cause non-deterministic behavior

[jQuery] [Autocomplete] result accompanied with blur cause non-deterministic behavior


I have the blur event hooked in to reset hidden field values. The
autocomplete plugin is set up as below and produces the behavior
described in the comments:
$("#test").autocomplete(data, {
formatItem: function(item) {
return item.text;
}
}).result(function(event, item) {
// This executes if a resultset item is selected with keyboard or
mouse
setTestKey();
});
$("#test").blur(function () {
// If a resultset item is selected with the mouse, this executes
first followed by the AC result
resetTestKey();
});
Is there a recommended way of doing this? I guess I could set up the
blur event to do all the work using autocomplete's search event but
I'm a little too lazy to do that :)