title: Javascript taking too long to run
body: <p>I have a script that is taking too long to run and that is causing me This error on ie : a script on this page is causing internet explorer to run slowly.</p>
  
  <p>I have read other threads concerning this error and have learned that there is a way to by pass it by putting a time out after a certain number of iterations. </p>
  
  <p>Can u help me apply a time out on the following function please ? </p>
  
  <p>Basically each time i find a hidden imput of type submit or radio i want to remove and i have a lot of them . Please do not question why do i have a lots of hidden imputs. I did it bc i needed it just help me put a time out please so i wont have the JS error. Thank you</p>
  
  <pre><code>$('input:hidden').each(function(){
      var name = $(this).attr('name');
      if($("[name='"+name+"']").length &gt;1){
          if($(this).attr('type')!=='radio' &amp;&amp; $(this).attr('type')!=='submit'){
              $(this).remove();
          }
      }
    });
  </code></pre>
  
  <p>One of the exemples i found : <a href="https://stackoverflow.com/questions/7655301/bypassing-ies-long-running-script-warning-using-settimeout">Bypassing IE&#39;s long-running script warning using setTimeout</a></p>