Tengo una variable llamada con una descripción.
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="">";Ahora estoy tratando de eliminar el elemento de la tabla y los elementos de la imagen con el siguiente código:
data.data.description.replace(/<img[^>]*>/g, '').replace(/<table[^>]*>/g, '')Elimina la tabla y el elemento de imagen, pero aún muestra algo como esto:
<strong>Waterproof rate</strong>" IP67 " etc.....¿Cómo es posible eliminar completamente el elemento de la mesa y los elementos dentro de la mesa?. Gracias.