How to replace part of an HTML tag with jQuery?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/918792/use-jquery-to-change-an-html-tag">Use jQuery to change an HTML tag?</a>  </p>
</blockquote>



<p>I have searched around for a while but haven't found an answer that quite matches what I am trying to do. I would like to be able to replace part of an html tag without actually replacing everything. For example my HTML...</p>

<pre><code>&lt;a href=""&gt;Test&lt;/a&gt;
</code></pre>

<p>I would like the end result to be something like this...</p>

<pre><code>&lt;test href=""&gt;Test&lt;/a&gt;
</code></pre>

<p>I have tried this... but it just replaces everything...</p>

<pre><code>$("a").replaceWith("&amp;lt;test");
</code></pre>

<p>This doesn't seem to work either...</p>

<pre><code>$("a").find().html("&lt;a").replaceWith("&amp;lt;test");
</code></pre>

<p><strong>EDIT:</strong></p>

<p>I don't think I was very clear with my first part. My end goal is to only replace just part of the tag... For example..</p>

<p>find <strong><code>&lt;a</code></strong> and replace it with <strong><code>&lt;test</code></strong></p>

<p>........</p>

<p>I feel like I am heading down the right path but I am not sure where to go from here. Any help is much appreciated. Thanks.</p>
