I have a div like this:
$("div").on("click", function(){
$("div").css({"background-color":"#f1f1f1"});
$("div").text('Sending ... (I want diactivate :hover)');
setTimeout(function(){
$("div").text('Click (I want activate :hover again)');
$("div").hover(function(e) {
$(this).css("background-color","#ddd8")
});
}, 5000);
});
div{
padding: 20px;
border: 1px solid #999;
text-align: center;
background-color: #f1f1f1;
cursor: pointer;
}
div:hover{
background-color: #ddd;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Click (I want activate :hover)</div>
I want when user clicks on that div, :hover get disable and after 5sec it get enable again. But in my code it just deactivate. How can I make it activate again?
$(this).removeAttr('style')and remove the inline style so it no longer overrides the stylesheet, but all of this is really a bad idea, and probably not the way you should be doing it.