0

I want to add a class to a div after 2 seconds of the pageload, please guide me how can I do it with jquery.

Adnan Niazi
  • 85
  • 4
  • 10

1 Answers1

2

You can try like this.$(window).ready(function(){}) will not call till your whole page will be ready and setInterval() will call after 2 sec.

$(window).ready(function(){
  setInterval(function(){ 
    $('div').addClass("test")
  }, 2000);

});
<div>Class
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
Bharat
  • 2,441
  • 3
  • 24
  • 36