In need to develope page like below
if(theString.length>100){ theString = theString.substr(0,100)+'...'; }
You can use the code like below to truncate the string variable:
function truncate(input, noOfChar) { if (input.length > noOfChar) { return input.substring(0, noOfChar) + '...'; } return input; };
Usage:
theString = truncate(theString, 100);
You can use the code like below to truncate the string variable:
Usage: