title: How to enter function variation?
body: <p>How can I put <strong>var this</strong> , into attr in the picture?<br>
  because that was replaced to be innerHTML</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;script type="text/javascript" src="http://line25.com/wp-content/uploads/2010/jquery-lightbox/demo/js/jquery.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;button href="http://allcartooncharacters.com/wp-content/uploads/2014/05/Tweety-310x310.png"&gt;Try it&lt;/button&gt;
  
  &lt;p id="demo"&gt;
  &lt;img src="http://www.w3schools.com/jquery/img_pulpitrock.jpg" alt="Pulpit Rock" width="284" height="213"&gt;
  &lt;/p&gt;
  
  &lt;script&gt;
  $(document).ready(function() {
     $('button').click(function() {
         var this = $("button")[0].getAttribute("href"); 
         $("#demo img").attr("src", '+ var this +');
     });
  });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And what if I want to add the function of loading ? maybe if the image is successfully opened , the loading will disappear like this</p>
  
  <pre><code>if (loading) {
      $(".loading-picture-gif").show();
  } 
  else {
      $(".loading-picture-gif").hide();
  }
  </code></pre>