I want to replace the 'product' class with the 'product-buy' class with javascript, as soon as I move the mouse over the div. How do I make this code?
Js
$(function(){
$(".produto").hover(
function(){
//Ao posicionar o cursor sobre a div
$(this).addClass('produtocomprar');
},
function(){
//Ao remover o cursor da div
$(this).removeClass('produtocomprar');
}
);
Css
.produto {
position: relative;
width: 190px;
height: 340px;
margin-left: 40px;
margin-top: 20px;
float: left;
display: flex;
flex-direction: column;
background-color: #ffffff;
}
.produtocomprar {
position: relative;
width: 200px;
height: 340px;
margin-left: 40px;
margin-top: 20px;
float: left;
display: flex;
flex-direction: column;
background-color: red;
}