jQuery: shorten string length to fit a set width.

Posted by Marius on Stack Overflow See other posts from Stack Overflow or by Marius
Published on 2010-03-30T16:40:17Z Indexed on 2010/03/30 16:43 UTC
Read the original article Hit count: 739

Filed under:
|
|
|

Hello there,

I have a table, and in each cell I want to place strings, but they are much wider than the cell width. To prevent line break, I would like to shorten the strings to fit the cell, and append '...' at end to indicate that the string is much longer.

The table has about 40 rows and has to be done to each cell, so its important that its a quick. Should I use JS/jQuery for this?

How would I do it?

Thank you for your time.

Kind regards,
Marius

© Stack Overflow or respective owner

Related posts about shorten

Related posts about string