Jquery Delay Example - Jquery

How to use delay method in jquery?

Snippet Code

Rate this page :
  [ 0 votes]

This example jquery code allows to execute a function with some delay time. Here the delay() method is used to set delay time in milliseconds. The sample jquery code is given below to create a time delay to display div.

<script src="https://code.jquery.com/jquery-1.10.2.js"></script> <style> .demo { background-color: #3f3; width: 60px; height: 60px; } </style> <div align='center'> <input type='button' value='Click' id='click'></br></br> <div class="demo"></div> </div> <script type='text/javascript'> $( "#click" ).click(function() { $( "div.demo" ).slideUp( 300 ).delay( 1000 ).fadeIn( 400 ); }); </script>


Ask Questions

Ask Question