forum

Home / DeveloperSection / Forums / Change background color on mouseover and remove it after mouseout

Change background color on mouseover and remove it after mouseout

Anonymous User 1076 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?


Updated on 27-May-2018
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By