When a user performs a certain action (typing) I run a function that applies a specific styling to that user in a list of 100s of users. As the user continues to type this funct
Use JavaScript's setTimeout()
method to invoke a method to remove the styling after 3 seconds (3000 ms). See below:
var timeout;
function clearStyling() {
// clear your styling here
};
$("#typingBox").on("keypress", function() {
clearTimeout(timeout);
timeout = setTimeout(clearStyling, 3000);
// do your styling here ...
});