Using jQuery's unwrap() to remove a class <p>I want to remove the class of <code>emphasis</code> from all tags that have that class in a specific cell of the table. I'm selecting the table cell content like this: </p> <pre><code>var answer = $('tr.problem_display_work:last td:first').html(); </code></pre> <p>In another place in the code, I'm using <code>unwrap()</code> like this: </p> <pre><code>$(".emphasis").contents().unwrap(); </code></pre> <p>However, I'm not sure how to combine the two. I tried this, but it failed:</p> <pre><code>var answer = $('tr.problem_display_work:last td:first').html().(".emphasis").contents().unwrap(); </code></pre> <p>Any ideas?</p> <p>EDIT FOR CLARIFICATION #1: I want to keep the HTML inside the tag. So, if I have: <code>14 + 6 = &lt;span class="emphasis"&gt;20&lt;/span&gt;</code> I want to end up with <code>14 + 6 = 20</code>.</p> <p>EDIT FOR CLARIFICATION #2: The HTML in question is getting set as the value for a hidden <code>&lt;input&gt;</code> field like this <code>$('#answer').val(answer);</code>. Gleb Kemarsky's solution is good, but it doesn't get applied the value for the input field for some reason.</p> <p>EDIT FOR CLARIFICATION #3...</p> <p>I have a <code>&lt;table&gt;</code> with some rows and cells. In the first cell of the last row I have some content (<code>14 + 6 = &lt;span class="emphasis"&gt;20&lt;/span&gt;</code> for example).</p> <p>I use <code>var answer = $('tr.problem_display_work:last td:first').html();</code> to get the HTML of that cell, then I use <code>$('#answer').val(answer);</code> to update the value of a hidden <code>&lt;input id="answer"&gt;</code>. </p> <p>When that happens, I'd like to turn <code>14 + 6 = &lt;span class="emphasis"&gt;20&lt;/span&gt;</code> into <code>14 + 6 = 20</code> for the value of the hidden <code>&lt;input id="answer"&gt;</code>, but leave it as <code>14 + 6 = &lt;span class="emphasis"&gt;20&lt;/span&gt;</code> in the table.</p> <p>EDIT FOR CLARIFICATION #4...</p> <p>The key is that any <code>&lt;span&gt;</code>s with the class of <code>emphasis</code> be removed. </p> <p>This.. <code>&lt;span class="emphasis"&gt;&lt;div class="fraction_display"&gt;&lt;span class="numer_display"&gt;21&lt;/span&gt;&lt;span class="bar_display"&gt;/&lt;/span&gt;&lt;span style="border-top-color: green;" class="denom_display"&gt;23&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;</code></p> <p>should end up as... <code>&lt;div class="fraction_display"&gt;&lt;span class="numer_display"&gt;21&lt;/span&gt;&lt;span class="bar_display"&gt;/&lt;/span&gt;&lt;span style="border-top-color: green;" class="denom_display"&gt;23&lt;/span&gt;&lt;/div&gt;</code></p>