title: jQuery Replace part of string
body: <p>I have the following code:</p>
  
  <pre><code>​&lt;div id="container"&gt;
   &lt;input type="text" name="a1" id="a1"&gt;
   &lt;input type="text" name="a2" id="a2"&gt;
  ​&lt;/div&gt;​​​​​​​​​​​​​​​​
  </code></pre>
  
  <p>And I want to replace all instance of the text "a" to "b" for the id and name property for all the element inside the div id="container"</p>
  
  <p>so the new code should be like this:</p>
  
  <pre><code>​&lt;div id="container"&gt;
   &lt;input type="text" name="b1" id="b1"&gt;
   &lt;input type="text" name="b2" id="b2"&gt;
  ​&lt;/div&gt;​​​​​​​​​​​​​​​​
  </code></pre>
  
  <p>I just can't seem to be able to make it work using the javascript replace().</p>