restrict character length to display in jquery table with handlebars

handlebars.js

Solution

Use Handlebars helpers:

Handlebars.registerHelper('dotdotdot', function(str) {
  if (str.length > 10)
    return str.substring(0,10) + '...';
  return str;
});

After that, in your template write

{{dotdotdot productDescription}}

Problem

How do i restrict the characters to display with my jqurty table that gets populated from `Handlerbars.Compile` ``` Handlebars.compile('<tr><td>{{productDescription}}</td></tr>') ``` I want to display only first 10 characters and want to show `...` which if the user clicks on should invoke a jqueryui dialog that shows the entire product description.

Original source