title: replace a attribute value in dom element
body: <p>I want to replace one of the attribute of anchor tag to different value. How can i achieve this. 
  I used <code>replaceWith()</code> of jquery where it will replace complete anchor tag itself instead of attribute and 
  "replace" method of string am not able to use it since we cannot call this on element.</p>
  
  <p>code below:</p>
  
  <pre><code>this.ui.$levels.each(function(i, el) {
              var $self = $(el),
  ......
  ..
  }
  </code></pre>
  
  <p>here self has html element, I need to modify one of the attribute value.</p>
  
  <p>attr() of jquery should do. But problem is if I use $self.find('a').attr('id',' val'), it will replace in all anchor tag.I don't know which anchor to replace, I need to search for the specific id, if id is present then only it should replace.</p>
  
  <p>Ex:consider $self contains below code snippet</p>
  
  <pre><code>  &lt;div class="abc"&gt;
       &lt;div class="xyz"&gt;
         &lt;a href=# id="repplace_id"&gt;&lt;/a&gt;
      &lt;/div&gt;
     &lt;/div&gt;
  </code></pre>
  
  <p>Here I need to modify the id of anchor tag to some other value. Please help</p>
  
  <p>Help is appreciated.</p>
  
  <p>Many thanks in advance.</p>