JS timeout example

by Sreeraj Saseendran

HTML

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
  <div id="square">

  </div>

CSS

#square{
  width: 100px;
  height: 100px;
  background: red;
}
.highlight{
  border: 6px solid yellow
}

JavaScript

$(document).ready(function(){
let el = '#square';


setTimeout(function(){
     $(el).addClass('highlight')
},600);

setTimeout(function(){
     $(el).removeClass('highlight');
},1000);

});