I would prefer using IDs for finding the template as there should be only one template of each kind anyway.

Anyway I like using templates, thank you!
Would be great if all the other html snippets in the javascript code could be extracted too.

But I think this is good enough to be merged now.

The javascript code could be refactored anyway...