How to remove class from an element after delay using jQuery


How to remove class from an element after delay using jQuery How to remove class from an element after delay using jQuery

Free


Tested pass quality product

Included new future

Demo Download

Free jQuery snippet to remove class from an element after delay of a few seconds. This snippet uses setTimeout function to delay the execution of the script. To remove class we simply use removeClass jQuery function.

Here is the example code:

<script>
$(document).ready(function () {
$("div").addClass("red");

setTimeout(function() {
$("div").removeClass("red");
}, 3000);
});
</script>

Give feedback