Reading list Switch to dark mode

    How to change background color on mouse-over by Javascript

    Updated 16 July 2021

    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 = ""; };
    }
    }

    Start your headless eCommerce
    now.
    Find out More
    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