Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
51
rated 0 times [  54] [ 3]  / answers: 1 / hits: 18260  / 14 Years ago, tue, december 28, 2010, 12:00:00

In my html page I have tooltip. Some strings are not fitting correctly because of their length in the Tooltip image. But, I'mm not allowed to crop the string from server side.



I want to make the ToolTip to show first 8-12 chars and followed by dots.



Is there any inbuilt function available for it in javascript or jquery.



Thanks!


More From » jquery

 Answers
14

You can use string.substring(from, to): http://www.w3schools.com/jsref/jsref_substring.asp



Then just append ...



var x = a really long line of text;
var toolTipText = x.substring(0, 8) + ...;

[#94459] Monday, December 27, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
efren

Total Points: 186
Total Questions: 85
Total Answers: 112

Location: Turkmenistan
Member since Sat, Apr 16, 2022
2 Years ago
;