jQuery addClass example

Change class name on click in jQuery

by Dmitri Ganenco

HTML

<div id="loader">
  <table height='100%' width='100%' style='cursor:wait'>
    <tr>
      <td style='vertical-align: middle' align='center'>
        <img alt='' src='/_imgs/AdvFind/progress.gif' height="25px" />
        <div /><span style='font-family:Tahoma,Arial;font-size: 11px;'>asd</span>
      </td>
    </tr>
  </table>
</div>

<button type='button' id='btnLoadData'>
  Load smth
</button>

JavaScript

$('#btnLoadData').on('click', function() {
   $('.loader').show();
   setTimeout(function() {
     $('.loader').hide();
   }, 2000);

 });