handlebars.js - restrict character length to display in jquery table with handlebars -
how restrict characters display jqurty table gets populated handlerbars.compile
handlebars.compile('<tr><td>{{productdescription}}</td></tr>')
i want display first 10 characters , want show ...
if user clicks on should invoke jqueryui dialog shows entire product description.
use handlebars helpers:
handlebars.registerhelper('dotdotdot', function(str) { if (str.length > 10) return str.substring(0,10) + '...'; return str; });
after that, in template write
{{dotdotdot productdescription}}
Comments
Post a Comment