Is there a way to apply a CSS attribute to a specific element (like a div) for only 2 seconds? Here is what I have tried so far:
HTML:
<div class="custom-div">bar</div>
<input class="button" type="button" value="press me" />
JQuery:
$(".button").click(function(e) {
$(".custom-div").css({"background-color": "lightblue"});
});
The issue with the code above is that it will maintain the changes indefinitely. Is there a way to restrict this change to a specific time frame?