title: jQuery make global variable
body: <p>How to pass function <code>a_href = $(this).attr('href');</code> value to global <code>a_href</code>, make <code>a_href="home"</code></p>
  
  <pre><code>var a_href; 
  
      $('sth a').on('click', function(e){
          a_href = $(this).attr('href');
  
            console.log(a_href);  
           //output is "home"
  
          e.preventDefault();
      }
  
  console.log(a_href);  
  //Output is undefined 
  </code></pre>