[jQuery] How to have Autocomplete dropdown act like select box and trigger onchange event for input

[jQuery] How to have Autocomplete dropdown act like select box and trigger onchange event for input


I am trying to replace a previous bit of html that managed input by
both an input and a select box. I now want to work with a single input
field using
jquery.autocomplete.js, but I have not been able to get autocomplete
to use the onchange JavaScript code used by that previous bit of html.
I have gotten autocomplete to display and select all the values
correctly in multiple analogous fields on the same form, but I do not
know how to have it trigger the code that was previously run under an
onchange event. Unfortunately, I do not understand much of the jquery
and autocomplete code, and I am only moderately more familiar with
JavaScript.
Here is a bit of the current relevant code:
<input class="text" id="city<%=addID%>" type="text"
name="city<%=addID%>" size="30" maxlength="120" value="<c:out value="$
{partyAddress.city}"/>" onchange="javascript: updatePartyAddress(this,
<%=addID%>);" >
...
var idList = "<%=addIDStringBuffer.toString()%>"; // This is a list
comprising a unique identifier, the "addID" (see html input box
above), for each address on the page.
var idArray = idList.split(",");
$(document).ready(function() {
for(var i=0; i< idArray.length; i++) {
$("#city"+idArray[i]).autocompleteArray(
[
<%=cityList.toString()%>
],
{
delay:10,
autoFill:true,
max:10
}
);
}
});
As I am very much a newbie to JavaScript and its plugins, any simple,
or more complex but step-by-step, help would be greatly appreciated.
Mark R. Thompson