I have a variable called with a description.
var description = "<p>There are two 9-inch (228mm) lights available, a spread beam driving light and a pencil beam spot light, both are high-powered. The driving light provides over 460 metres @ 1 Lux, while the spot light covers 900 metres @ 1 Lux meaning a driving / spot combo is producing some serious light on the road. But, as they are sold in mix and match kits, or individually, you can bias your purchase to maximum distance or serious spread.</p>
<table style="height: 299px; width: 584px;" width="584" align="center">
<tbody>
<tr style="height: 23px;">
<td style="width: 276.469px; height: 23px;"> </td>
<td style="width: 291.531px; height: 23px;"><strong>PIR91145S</strong></td>
</tr>
<tr style="height: 23px;">
<td style="width: 276.469px; height: 23px;"><strong>Waterproof rate</strong></td>
<td style="width: 291.531px; height: 23px;">IP67</td>
</tr>
<tr style="height: 23px;">
<td style="width: 276.469px; height: 23px;"><strong>Product dimension</strong></td>
<td style="width: 291.531px; height: 23px;">ф228.6*86.7mm</td>
</tr>
<tr style="height: 23px;">
<td style="width: 276.469px; height: 23px;"><strong>LED Type</strong></td>
<td style="width: 291.531px; height: 23px;">OSRAM</td>
</tr>
<tr style="height: 23px;">
<td style="width: 276.469px; height: 23px;"><strong>Effective Lumen</strong></td>
<td style="width: 291.531px; height: 23px;">10485 LM</td>
</tr>
</tbody>
</table>
<img src="" id="" name="">";
Now I am trying to remove table element and image elements with the following code:
data.data.description.replace(/<img[^>]*>/g, '').replace(/<table[^>]*>/g, '')
It do remove the table and image element but it still display something like this:
<strong>Waterproof rate</strong>" IP67 " etc.....
how is it possible to remove completely the table element and the elements inside the table?. thanks.