I have an HTML string. I’d like to transform this:
<table >
<tr>
<td><a href="/link.html" onclick="javascript:aFunction()">some text</a></td>
<td><a href="/anotherlink.html">some more text</a></td>
</tr>
</table>
Into this:
<table >
<tr>
<td>some text</td>
<td>some more text</td>
</tr>
</table>
In jQuery 1.4+, you can pass a function to
.replaceWith(), like this:You can give it a try here.
If you literally have a string, and not elements, it would look like this:
You can try that version here.