title: Replace image file name by jquery
body: <p><em>I have find related answer but not same like this topic, so i asked this question.</em>
  <br></p>
  
  <p>My question is, i'm trying to replace image file name <code>default.jpg</code> to <code>hqdefault.jpg</code> from all images below, I'm unable to change image links manually, so i have to change it by jquery.</p>
  
  <p><strong>Images</strong>  </p>
  
  <pre><code>&lt;div id="selector"&gt;
      &lt;img src="http://img.youtube.com/vi/qDc_5zpBj7s/default.jpg"&gt;
      &lt;img src="http://img.youtube.com/vi/ss7EJ-PW2Uk/default.jpg"&gt;
      &lt;img src="http://img.youtube.com/vi/ktd4_rCHTNI/default.jpg"&gt;
      &lt;img src="http://img.youtube.com/vi/0GTXMEPDpps/default.jpg"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS</strong>  i'v tried </p>
  
  <pre><code>$('#selector img').attr('src',function(i,e){
      return e.replace("default.jpg","hqdefault.jpg");
  });
  </code></pre>
  
  <p>Problem is it change(remove) whole links to <code>hqdefault.jpg</code>, but i <strong>want to change only</strong> <code>default.jpg</code> to <code>hqdefault.jpg</code> from all/any image src.</p>
  
  <p>How to replace all image file name simply?</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>&lt;img src="http://img.youtube.com/vi/qDc_5zpBj7s/default.jpg"&gt;
  to
  &lt;img src="http://img.youtube.com/vi/qDc_5zpBj7s/hqdefault.jpg"&gt;
  </code></pre>
  
  <p>Don't use full image link on js, because video generate image links/id dynamically, just replace <code>default.jpg</code> to <code>hqdefault.jpg</code> by jquery.</p>