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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -