Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
171
rated 0 times [  177] [ 6]  / answers: 1 / hits: 19385  / 13 Years ago, thu, december 8, 2011, 12:00:00

I have a HTML page which shows a Name dynamically. Now this name (FN LN) can be upto 240 charcaters. But at the UI side, I want to trim the FN/LN after about 50 characters and replace with ...



How can I do this using Javascript/jQuery


More From » jquery

 Answers
13
$(#FN, #LN).each (function () {
if ($(this).text().length > 50)
$(this).text($(this).text().substring(0,50) + '...');
});


This should work.


[#88680] Wednesday, December 7, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dustin

Total Points: 599
Total Questions: 105
Total Answers: 106

Location: Belarus
Member since Tue, Mar 14, 2023
1 Year ago
dustin questions
;