Javascript examples for jQuery Method and Property:delay
Delay running a function for 3 seconds
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){/*from www . j av a 2 s . c o m*/ $('#txt1').on('blur', function () { var $this = $(this); if ($this.val() === '') { setTimeout(function () { $this.val('4/11/2018'); }, 3000); } }); }); </script> </head> <body> <input type="text" id="txt1"> </body> </html>