Webkul
Services
Technologies Bagisto QloApps
iOS Android SAP BigCommerce Wix
Trusted by
Samsung Intel Toyota Walmart Disney Nokia Nestlé Decathlon
See all customers
Back to Top
DOC

How to change background color on mouse-over by Javascript

Simple code to change background color and color of your text on mouse-over by Javascript.

You can change any CSS attribute bye this code.

var howervar= document.getElementsByClassName("class-name");
if (howervar!= null) {
if (howervar[0] != null) {
howervar[0].style.backgroundColor = "#365890";
howervar[0].style.color = "#FFFFFF";
}
for (var i = 0; i < tbl.length; i++) { 
howervar[i].onmousemove = function () { this.style.backgroundColor = "#365890"; this.style.color = "#FFFFFF"; };
howervar[i].onmouseout = function () { this.style.backgroundColor = ""; this.style.color = ""; };
}
}
css
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home