You definitely want to use a JS templating framework for this, rather than building up HTML by concatenating strings. [`_.template`](http://underscorejs.org/#template) and [Mustache](https://github.com/janl/mustache.js) are both good options, and are both already in our repository.