[jQuery] [autocomplete] onItemSelect function not running
I’m using the autocomplete plugin 1.0.2 from
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ and
have got it mostly running smoothly, but I’m having problems with the
onItemSelect option. It doesn’t seem to run. I cannot find any
reference to onItemSelect within jquery.autocomplete.js, however, it
does exist in previous/other authors versions. Perhaps an additional
library, such as jQueryUI, is needed to enable it?
The function and initialisation follow (note: I’m not particularly
worried about the interior of the selectItem function, as it doesn’t
even appear to run.
$("#city").autocomplete(localities,
{formatItem:formatItem,formatResult:formatResult,onItemSelect:selectItem});
function selectItem(li) {
alert('hi');
if ((li.extra != null) && (li.extra != "")) {
$("#postcodes").val(li.extra[1]);
$("#state").val(li.extra[0]);
}
}
If anyone can help in letting me know why the onItemSelect function
isn’t running, it would be appreciated greatly.
Regards,
Garth McMillan