title: jQuery .each and setTimeout is not working
body: <p>I am trying to get some attar vale from an active slider. I have used each and setTimeout function. Initially, that worked. But after some time the slider stops if I use this code. Note this code is independent of the slider code. </p>
  
  <pre class="lang-js prettyprint-override"><code>function checkForChanges() {
    $('#ninja-slider ul li').each(function(i) {
      if ($(this).hasClass("ns-show")) {
        //$(this).css("color", "red");
        console.log('yes')
      } else {
        setTimeout(checkForChanges, 3000);
        console.log('no')
      }
    });
  }
  
  $(checkForChanges);
  </code></pre>