Answers for "hover vanilla js"

13

addeventlistener hover js

let test = document.getElementById("test");

test.addEventListener("mouseover", function( event ) {
  alert("mouse over test!")
  , false);
Posted by: Guest on May-31-2020
0

hover vanilla javascript

var target = document.querySelector(".button");
target.addEventListener("mouseover", mOver, false);
target.addEventListener("mouseout", mOut, false);

function mOver() {
   target.setAttribute("style", "background-color:blue;")
}

function mOut() {  
   target.setAttribute("style", "background-color:green;")
}
Posted by: Guest on February-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language