JQuery set text with delay - Javascript jQuery

Javascript examples for jQuery:Text

Description

JQuery set text with delay

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
  <script type="text/javascript">
    window.onload=function(){//from  w  w w  .j  a  va 2s.co m
$('#logout').click(function() {
   $(this).html('Waiting');
   setTimeout(function() {
      $('#logout').html('Success');
   }, 3000);
});
    }

      </script> 
 </head> 
 <body> 
  <button type="button" class="list-group-item" id="logout"> Log out</button>  
 </body>
</html>

Related Tutorials