How to remove class after delay in jQuery

If you want to perform some animation in jquery like want to remove class after n number of seconds then jquery is right tool for making this happen just copy and paste below code snippet and set time interval.


Remove class after delay in jQuery

$(function() {  
var ln = $('#ln');
ln.addClass('className');
setTimeout(function() {
	ln.removeClass('className');
}, 5000);
});

In the above code adding className on page load and removing after delay of 5sec.


2 Replies to “How to remove class after delay in jQuery”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.