there is long string, like
<td>sdfaf</td><td width='1'></td><td width='1'>sdfdsf</td><td></td>
Is there a simple regex method to delete contents inside tags, convert it to
<td></td><td width='1'></td><td width='1'></td><td></td>
I know jquery html() and empty() can do the work, but I want to find a pure javascript method to do it.
thanks
Assuming your “string” comes from a table in your document, here’s how to do it in vanilla javascript :
(if you just have the string, you may simply create a
trnode and set this string as innerHTML)