Hi Team
I need some help, i have a form and its working fine. I only need some help, when i select user details after search. their details from form when i mouse hover i must be able to see user email detail. Kindly please assist and thank you.
Code
Select People and Groups
×
Search
.light-grey-list li {
background-color: #808080; /* Dark Grey color */
padding: 5px;
}
All Users [0]
Active Directory [0]
Organization [0]
Details
Display Name
E-mail Address
Title
Department
Presence
Work Phone
Location
$(document).ready(function () {
// Function to handle search button click event
$('#searchButton').on('click', function () {
var searchTerm = $('#searchInput').val().trim();
if (searchTerm !== '') {
// Send an AJAX request to the controller action to search for users
$.ajax({
url: '@Url.Action("SearchUsers", "Home")',
type: 'POST',
dataType: 'json',
data: { searchTerm: searchTerm },
success: function (data) {
// Clear previous search results
$('#userTable tbody').empty();
// Iterate through the retrieved user details and append them to the table
$.each(data, function (index, user) {
var row = '' +
'' + user.DisplayName + '' +
'' + user.Email + '' +
'' + user.Title + '' +
'' + user.Department + '' +
'' + user.Presence + '' +
'' + user.WorkPhone + '' +
'' + user.Location + '' +
'';
$('#userTable tbody').append(row);
});
// Show the modal with search results
$('#checkDetailsModal').modal('show');
// Update user counts
var totalUsers = data.length;
var activeDirectoryCount = data.filter(user => user.Location === 'Active Directory').length;
var organizationCount = data.filter(user => user.Location === 'Organization').length;
$('#totalUsersCount').text(totalUsers);
$('#activeDirectoryCount').text(activeDirectoryCount);
$('#organizationCount').text(organizationCount);
// Show the user counts with brackets
$('#usersCount').toggle(totalUsers > 0);
$('#activeCount').toggle(activeDirectoryCount > 0);
$('#orgCount').toggle(organizationCount > 0);
},
error: function (jqXHR, textStatus, errorThrown) {
// Handle error if any
console.error('Error:', textStatus, errorThrown);
}
});
}
});
// Function to handle selecting a user from the table
$(document).on('click', '#userTable tbody tr', function () {
// Remove the 'selected' class from all rows
$('#userTable tbody tr').removeClass('selected');
// Add the 'selected' class to the clicked row
$(this).addClass('selected');
});
// Function to handle OK button click event
$('#okButton').on('click', function () {
// Get the selected user's display name and set it in the AuditType input field
var selectedUserDisplayName = $('#userTable tbody tr.selected td:first').text();
$('#auditor').val(selectedUserDisplayName);
// Close the modal
$('#checkDetailsModal').modal('hide');
});
// Function to handle modal close event when close button at the top is clicked
$('#checkDetailsModal').on('hidden.bs.modal', function () {
// Clear the search input field and remove the selected class from all rows when the modal is closed
$('#searchInput').val('');
$('#userTable tbody tr').removeClass('selected');
});
// Function to show user email address on mouse hover
$(document).on('mouseenter', '#userTable tbody tr td', function () {
var email = $(this).data('email');
$(this).attr('title', email);
});
});
OK
Cancel
Mithilesh TataRank #862 · 2.6K reputationPosted Mar 4, 2024, 3:25 AM EST
To display the user's email address when hovering over their details in the modal form, you can use the
titleattribute of the HTML elements to show the email address as a tooltip. Here's how you can modify your script to achieve this:$(document).ready(function () { // Function to show user email address on mouse hover $(document).on('mouseenter', '#userTable tbody tr td', function () { var email = $(this).data('email'); $(this).attr('title', email); }); });This script will attach a mouseenter event listener to the table cells () within the user table (
JavaScript
Know the answer? Forums 01
Arun PottiAnswers in the forums20answers02
Tahir AnsariAnswers in the forums5answers03
Kamlesh KumarAnswers in the forums5answers04
Sam HobbsAnswers in the forums4answers05
Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.Join Full leaderboard → 2026
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
#userTable). When the mouse enters a table cell, it will retrieve the email address associated with that cell's data and set it as the title attribute of the cell. This will display the email address as a tooltip when hovering over the cell.Make sure to place this script block after your existing script block within the
tags in your HTML code.With this modification, when you hover over any user's email address in the modal form, you should see their email address displayed as a tooltip.
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 4, 2024, 3:28 AM EST
$( document ).ready(function() { $('#userTable tbody tr td').on('mouseover', function() { var email = $(this).data('email'); $(this).attr('title', email).tooltip(); }); });Hello,
Please change here in this function,
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts