on-internet
← Community

format string as table in javascript

Stack Overflow ·

Is it possible to achieve this in javascript? Here is the format: 1 ITEM1 9.00 0% 9.00 1 ITEM-GET01 8.00 12% 5.00 I would like to create a receipt like layout. I'm using backbone.js so there will be models and collection involve. Also if it were on a table can I use jquery to get the data from the table tr then have the result just like what is posted above? I was able to read about sprintf but I don't think it it is the one I need. any ideas? UPDATE I'm trying out sprintf here is what i've come so far var result = sprintf("%d %-s %.2f %d%% %.2f", model.get("Qty"), model.get("Itemname"), model

Comments

Sign in or sign up to comment and upvote.

No comments yet.