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

129
Views
Haga que la cantidad de primeros y últimos caracteres mostrados responda al ancho disponible

Tal vez alguien sepa cómo hacer que el texto o los números dentro de una celda de tabla cambien dinámicamente. ¿Y si el número o el texto no cabe en la celda, se cortó por la mitad con puntos suspensivos, y las letras o números que se encuentran en ese extremo se ocultaron o aparecieron por completo al cambiar el tamaño?

OA210815LXRR1I OA210...LXRR1I OA2...RR1I

Me gustaría crear algo como esto: js fiddle

pero no sé cómo solucionar el problema de recorte de letras cuando cambia el tamaño

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

0

Intenta hacer esto:

 var MaxLen = 10; var limiLen = 5; var text = document.getElementById("text-test"); if (text.innerHTML.trim().length > MaxLen) { var newTest = text.innerHTML.trim().substr(0, limiLen) + "..." + text.innerHTML .trim() .substr(text.innerHTML.trim().length - limiLen, limiLen); text.innerHTML = newTest; }
 <html> <head> <title> Response </title> <meta charset="UTF-8" /> </head> <body> <div> <p id="text-test"> ABCDEFGHIJKLMNOPQRSTUVWXYZ </p> <div> <script src="index.js"> </script> </body> </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!