JQuery Autocomplete triggers a focus event when the user mouses over or otherwise highlights one of its <li>
options. Within this event, I want to refer to the <li>
that is currently focused, but I can't figure out how to select it. At the moment, I have:
focus: function( event, ui ) {
var target = event.currentTarget
alert($(target).html())
}
But this returns the whole list of <li>
s, rather than just the currently focused one. I've tried other event methods, such as event.delegateTarget and event.target, but with no success. Is there another way to get the focused element?
console.log(ui)
. it's in there. – Hockenberryli
. – Earvin