title: How can I give control back (briefly) to the browser during intensive JavaScript processing?
body: <p>I have read the post <a href="http://www.julienlecomte.net/blog/2007/10/28/" rel="noreferrer">here</a> about using setTimeout() during intensive DOM processing (using JavaScript), but how can I integrate this function with the below code? The below code works fine for a small number of options, but when the number of options gets too big my "please wait" animated GIF freezes while the local JavaScript is processing. Thanks!</p>
  
  <pre><code>function appendToSelect() {
      $("#mySelect").children().remove() ;
      $("#mySelect").html(
          '&lt;option selected value="' + obj.data[0].value + '"&gt;'
          + obj.data[0].name
          + '&lt;/option&gt;'
      );
      var j = 1 ;
      for (var i = 1; i &lt; obj.data.length; i++) {
          $("#mySelect").append(
              '&lt;option value="' + obj.data[i].value + '"&gt;'
              + obj.data[i].name
              + '&lt;/option&gt;'
          ); 
      }
  }
  </code></pre>