title: jQuery Variables: Setting variables for the entire file
body: <p>Can you set variables in the beginning of a file to be set through out? </p>
  
  <p>Example:</p>
  
  <pre><code>var works = $('#id1'); 
  var span = $('.icon');
  
  works.focus(function() {
      if(this.value.length == 0)
      span.hide();
  });
  
  works.keyup(function() {
  
  if(this.value.length &gt; 0 &amp;&amp; !span.is(':visible'))
          span.stop().show();
      else if(this.value.length == 0)
          span.stop().hide();
  });
  </code></pre>
  
  <p>The variable span inside the function doesn't work. Instead of adding <code>var span = $('.icon');</code> in each function is it possible I can make it work?</p>
  
  <p>Thanks alot</p>