Skip to content

Instantly share code, notes, and snippets.

@amirmehmood
amirmehmood / gist:4419309
Created December 31, 2012 11:56
Truncate the string with the specified limit and append "..." at the end.
var truncText = "text to be truncated.";
var limit = 10;
if(truncText.length > limit)
{
truncText = jQuery.trim(truncText).substring(0, limit).trim(this) + "...";
}