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

170
Views
Modifique el código contenido en la variable usando JQuery. Eliminar atributo y envolver por div

Tengo html porque tengo una variable y trato de modificarla y aplicarla después, pero después de cambiarla, el código no cambia.

Entonces, básicamente, tengo un código con la tabla y qué eliminar el atributo y envolver por div.

 let paste = editor.node.innerHTML; //console.log(paste); console.log($(paste).filter("table")) $(paste).filter("table").each(function(i, item){ console.log($(this).attr('width')) $(this).removeAttr('width'); console.log(item) }) editor.node.innerHTML = paste console.log(paste) });

Obtuve con éxito ese ancho, pero después del bucle hice el registro y es igual que antes del bucle y el atributo todavía está allí

dame un consejo por favor

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tu codigo

 $(paste)

crea un objeto jquery, luego se le aplica el filtro/cada uno, es decir, al objeto jquery. No a la cadena de origen. La variable de paste original no se modifica.

Para actualizar su variable, debe reasignar el resultado de su manipulación, es decir:

 paste = $(paste) .filter("table") .each(function(i, item) { ... }) .html();
about 4 years ago · Juan Pablo Isaza Report
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!