Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
Eliminar atributos de etiqueta de html String en Javascript

estoy usando Puppeteer para obtener 2 tablas de una web.

Guardo esas tablas en 2 cadenas separadas, pero ahora quiero eliminar todos los atributos de identificación, clases y estilo de todas las etiquetas dentro de la tabla. Pero no puedo entender cómo, ¿hay alguna manera de que pueda trabajar con una cadena como si fuera html?

Esta es una muestra de la tabla que obtendría:

 <table id="xxxxx" class="aaaaa" role="ssssss"> <tbody> <tr class="ui-widget-content" role="row"> <td role="gridcell" class="ui-panelgrid-cell summaryPanelHeaderColumn">Hello</td> <td role="gridcell" class="ui-panelgrid-cell summaryPanelColumn"> <table> <tbody> <tr> <td class="rhthtyhyj"> <label style="display: block;">Hello text sample</label> </td> <td class="rwhgthyjy"> <button id="u6krkrik" name="j_idt111:0:j_idt124:0:j_idt129" class="ertjyjuejujm" onclick="wethyjyj.bcn(this,event,[function(event){rtyjeyjeuk.ab({s:&quot;jetrjyrjyj1:0:ryejyjy:0:j_idt129&quot;,e:&quot;click&quot;,p:&quot;j_idt111:0:j_idt124:0:j_idt129&quot;,u:&quot;ethtehth driveSummaryFieldSet&quot;});},function(event){PrimeFaces.ab({s:&quot;j_idt111:0:j_idt124:0:j_idt129&quot;});return false;}]);" type="submit" role="button" aria-disabled="false"> <span class="ui-button-icon-left ui-icon ui-c ui-icon-closethick"></span> <span class="ui-button-text ui-c">Again A sample text</span> </button> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table>

Y esta es la muestra de lo que me gustaría conseguir al limpiar la mesa:

 <table> <tbody> <tr> <td>Hello</td> <td> <table> <tbody> <tr> <td> <label>Hello text sample</label> </td> <td> <button> <span></span> <span>Again A sample text</span> </button> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table>

Simplemente limpiando los atributos de las etiquetas y manteniendo solo las etiquetas y el texto sin procesar dentro

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!