Search
 
SCRIPT & CODE EXAMPLE
 

HTML

js add class when hover

<script>
  $(document).ready(function () {
    $(".box").hover(
      function () {
        $(this).addClass("box-hover");
      },
      function () {
        $(this).removeClass("box-hover");
      }
    );
  });
</script>
Comment

add class on hover css

/* example: your html code is like this: 
<h2 class="firstname">Firstname </h2>
<p class="secondname">Secondname </p>
/*

h2.firstname:hover {
  background-color: yellow;
}

p.secondname:hover {
  background-color: blue;
}
Comment

PREVIOUS NEXT
Code Example
Html :: Html.Raw blazor 
Html :: mdb input bg 
Html :: bold in bootstrap 
Html :: html select default 
Html :: ngfor index 
Html :: add favicon to website html 
Html :: link email 
Html :: og html 
Html :: Ion-img in center of screen 
Html :: checked bootstrap 5 
Html :: spawn mob without ai 
Html :: align image/text 
Html :: textbox dropdown with manual input 
Html :: html option selected 
Html :: html paragraph background color 
Html :: input without autocomplete 
Html :: clear html screen 
Html :: onclick open new url html 
Html :: m3u8 ffmpeg download 
Html :: accept function jsf component 
Html :: ng build index html not working 
Html :: html dropdown 
Html :: ol list 
Html :: test image as base 64 string 
Html :: google logo link 
Html :: read only attribute in html 
Html :: not allow decimal in input type number 
Html :: select 
Html :: auto refresh 
Html :: onclick hide div javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =