It looks like you're trying to do templating! Maybe look into [underscore templates](http://underscorejs.org/#template) instead of keeping all this HTML in your javascript.