You can do this in pure CSS , but here you go:
$('tr').on('mouseenter mouseleave', 'td', function( e ){ $(this).fadeTo(500, e.type=="mouseenter" ? 1 : 0.85 ); });
Using hover:
$('tr td').hover(function( e ){ $(this).fadeTo(500, e.type=="mouseenter" ? 1 : 0.85 ); });
Tip:
.on('hover' does not bind direct links to mouseenter mouseleave events separately, as using the Method $(selector).hover(handlerIn, handlerOut) , but simply the hover event.
To renew:
$('tr').on('hover', 'td', function( e ){ // no separated "mouseenter" and no "mouseleave" e.type reference here :( // just "hover" event }); $('tr').on('mouseenter mouseleave', 'td', function( e ){ // e.type are defined :) }); $('tr').on('mouseenter', 'td', function( e ){ // function only for 'mouseenter' event }).on('mouseleave', 'td', function(){ // function only for 'mouseleave' event }); $('tr td').hover(function( e ){ // e.type "mouseenter" and "mouseleave" are in event reference :) }); // $("tr td").hover(handlerIn, handlerOut) $('tr td').hover(function(){ // Method default // e.type reference == "mouseenter" }, function(){ // Method default // e.type reference == "mouseleave" });
Now it depends on whether you need to delegate your events to elements using .on() (dynamically created elements) or .hover() , suitable only for your needs.
As for the .off() method, you can take a closer look at what it does: here
Basically, if at some point you want to remove any additional deletion of an event into an element, than use .off ():
$('#selector').on('click', 'button', function(){ // Function callback: alert('I will alert only once cause of off()'); $('#selector').off('click', 'button'); });