title: Forcing a DOM refresh in Internet explorer after javascript dom manipulation
body: <p>Here is the situation. I have some javascript that looks like this:</p>
  
  <pre><code>function onSubmit() {
      doSomeStuff();
      someSpan.style.display="block";
      otherSpan.style.display="none";
      return doLongRunningOperation;
  }
  </code></pre>
  
  <p>When I make this a form submit action, and run it from a non IE browser, it quickly swaps the two spans visibility and run the long javascript operation. If I do this in IE it does not do the swap until after onSubmit() completely returns.</p>
  
  <p>I can force a dom redraw by sticking an alert box in like so:</p>
  
  <pre><code>function onSubmit() {
      doSomeStuff();
      someSpan.style.display="block";
      otherSpan.style.display="none";
      alert("refresh forced");
      return doLongRunningOperation;
  }
  </code></pre>
  
  <p>Also, the obvious jquery refactoring does not affect the IE behavior:</p>
  
  <pre><code>function onSubmit() {
      doSomeStuff();
      $("#someSpan").show();
      $("#otherSpan").hide();
      return doLongRunningOperation;
  }
  </code></pre>
  
  <p>This behavior exists on IE8 and IE6. Is there anyway to force a redraw of the DOM in these browsers?</p>