title: What's The Correct Way To Set Src Attribute In JQuery?
body: <p>Suppose I have the following HTML:</p>
  
  <pre><code>&lt;img id="foo" src="bar1.jpg"/&gt;
  </code></pre>
  
  <p>I would like to switch the <code>src</code> to <code>bar2.jpg</code></p>
  
  <p>Can I just do this?</p>
  
  <pre><code>$("#foo").attr("src", "bar2.jpg");
  </code></pre>
  
  <p>Or do I have to do this?</p>
  
  <pre><code>$("#foo").removeAttr("src");
  $("#foo").attr("src", "bar2.jpg");
  </code></pre>
  
  <p>Thanks!</p>