I have written a function which implements autocomplete on the input field. In this function I am making an ajax call to get the data and then binding it to the input field and every thing is working fine. My new requirement is to show the email id when we hover the mouse on user name. I have searched for the events on the jQuery site but didn't find any event or method for mouse hover. Any help would be much appreciated.
function AutopopulateUsers(id, url) {
//url='@Url.Action("GetUserByName", "Home")'
$(id).autocomplete({
source: function (request, response) {
$.ajax({
url: url,
type: "POST",
dataType: "json",
data: { name: request.term },
success: function (data) {
response($.map(data.rows, function (item) {
return { label: item.Name, value: item.Name, info: $.trim(item.NetId) + '#' + item.UserId + '#' + item.Email };
}));
}
})
},
select: function (e, i) {
$(this).focus();
$(id).val(i.item.value)
var data = i.item.info.split('#');
if (data.length > 0) {
$(id).attr("data-userid", data[1]);
$(id).attr("data-netid", data[0]);
$(id).attr("data-email", data[2]);
$(id).data("userid", data[1]);
$(id).data("netid", data[0]);
$(id).data("email", data[2]);
}
return false;
},
close: function () {
var userId = $(id).data("userid");
if (userId == 0 || userId == null || userId == '' || userId == undefined) {
$(this).val('');
}
},
minLength: 3
});
}