title: Setting a Variable in Jquery or Javascript
body: <pre><code>$('#firstname').bind('focusout focusin', function() {
      var get_firstname = $("#firstname").val().replace(/ /g, "+");
      var n_firstname = get_firstname.length;
      if (n_firstname &gt; 2) {
          $(".firstname_good").fadeIn("fast");
          var firstname_v = 1;
      }
      else {
          $(".firstname_good").fadeOut("fast");
          var firstname_v = '';
      }
  });​
  </code></pre>
  
  <p>I'm have trouble understanding how to use the VAR firstname_v below. What do I need to do in the above to be able to use it below</p>
  
  <pre><code>$('#lastname').bind('focusout focusin', function() {
      if (firstname_v == 1) {
          alert(firstname_v);
      }
  });​
  </code></pre>