Jquery catching click event on jquery ui autocomplete

Like this http://jsfiddle.net/PUpRr/

select options should do the trick.

Options/events/methods API documentation : http://api.jqueryui.com/autocomplete/

Hope this fits the needs :)

Sample code

$("#to").autocomplete({
    source: function (request, response) {

        var friendsArray = [];
        friendsArray = [{
            "id": 1,
            "name": "hulk",
            "value": "hulk"
        }, {
            "id": 2,
            "name": "ironman",
            "value": "ironman"
        }, {
            "id": 3,
            "name": "Foobar",
            "value": "Foobar"
        }];

        response(friendsArray);
        return;


    },

    select: function (e, ui) {

        alert("selected!");
    },

    change: function (e, ui) {

        alert("changed!");
    }
});