title: Create variables on the fly
body: <p>Im creating code snippets dynamicly:</p>
  
  <pre><code>var gg = setInterval(function() {
      if($('p:visible').length &gt; 0) {
          $('p').trigger('click') ;
          clearInterval(gg);
      }
  },500);
  </code></pre>
  
  <p>The code works. The problem is that I create the same code snippets with different selectors:</p>
  
  <pre><code>var gg = setInterval(function() {
      if($('input:visible').length &gt; 0) {
          $('input').trigger('focus') ;
          clearInterval(gg);
      }
  },500);
  </code></pre>
  
  <p>So when I put(create) these codes together, the whole thing goes in to some loop and it doesn't work anymore, take a look at this example: <a href="http://jsfiddle.net/W3C4v/" rel="nofollow">JsFiddle</a> </p>
  
  <p>The problem is that I assign the same variable (gg) to the codes. So my question is: How do I create different variables every time I create these code snippets? I tried some things with <code>var x=x++</code> but I can't get it to work.    </p>