Answers for "do a element hover by jquery"

10

jquery hover

$( "td" ).hover(
  	() => { //hover
    	$(this).addClass("hover");
  	}, 
  	() => { //out
    	$(this).removeClass("hover");
  	}
);

//or
$( "td" )
  	.mouseover( () => {
    	$(this).addClass("hover");
  	}) 
  	.mouseout( () => {
    	$(this).removeClass("hover");
  	}
);

//or
$( "td" )
  	.mouseenter( () => {
    	$(this).addClass("hover");
  	}) 
  	.mouseleave( () => {
    	$(this).removeClass("hover");
  	}
);
Posted by: Guest on April-03-2020
3

hover jquery

$( "div.enterleave" )
  .mouseenter(function() {
    n += 1;
    $( this ).find( "span" ).text( "mouse enter x " + n );
  })
  .mouseleave(function() {
    $( this ).find( "span" ).text( "mouse leave" );
  });
Posted by: Guest on June-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language