Generate HTML using templates instead of jquery