Answers for "hover based on class 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
0

on hover add class on children jquery

$(document).ready(function()
  {
    $('li.active').hover(
      function(){ 
        $(this).children("a").addClass("icon-white"); //Add an active class to the anchor
      },
      function() {
        $(this).children("a").removeClass("icon-white"); //Remove an active class to the anchor
      }
   )
 });
Posted by: Guest on April-07-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language