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

114
Views
Limite el contenido html que se mostrará en la reacción que se muestra peligrosamentesetinnerhtml

Tengo algo de contenido html en la base de datos y estoy tratando de mostrarlo usando peligrosamentesetinnerhtml. Pero no quiero mostrar todo el contenido. Supongamos que tengo el contenido del texto y quiero mostrar solo los 100 caracteres seguidos de... . Mi contenido es-

<p><span style="color: rgb(35,38,41);background-color: rgb(255,255,255);font-size: 15px;font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif;">I came across the following line of code which I couldn't understand ,although there are lot of tutorials that gives information related to examples of</span> <code>populate</code> <span style="color: rgb(35,38,41);background-color: rgb(255,255,255);font-size: 15px;font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif;">but there is none that explains what exactly it means.Here is a example</span>&nbsp;</p>

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

0

Puede probar trunc-html , en nuestro sitio usamos este paquete y funciona muy bien, trunca el html de entrada por la longitud que desee, sin romper el árbol html, solo utilícelo así:

 const TruncHtml = require('trunc-html'); let html = result.html // or whatever the html comes from html = TruncHtml(html, 100).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!