How to show less content lines using jsom in sharepoint

20 Views Asked by At

In need to develope page like below 1

if(theString.length>100){
   theString = theString.substr(0,100)+'...';
}
1

There are 1 best solutions below

0
Ganesh Sanap - MVP On

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);