Users Pricing

forum

Home Forums Change background color on mouseover and remove it after mouseout – MindStick

Change background color on mouseover and remove it after mouseout

Anonymous User 1484 27 May 2018

I want to change the background color on mouse hover .This code works fine but I think this is not the right code

<script type="text/javascript">

    $(document).ready(function() {
        $('.test').bind("mouseover", function(){
            var color = $(this).css("background-color");

            $(this).css("background", "#380606");

            $(this).bind("mouseout", function(){
                $(this).css("background", color);
            })
        })
    })
</script>

can anyone tell me some other solution?


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md