[jQuery] Best Practices: Separating HTML from JavaScript

[jQuery] Best Practices: Separating HTML from JavaScript


I'm always looking for as loosely coupled a system as practical, and I
have a question about separating HTML from JavaScript (using jQuery).
What's the best way to apply a "template," so to speak, to some JS
method? I'm trying to create a button bar for a plugin, and it has to
be loaded in dynamically (can't be on the page already, mostly for
modularity, etc.). What practice is advocated by the jQuery community
when it comes to adding DOM elements?
One thing I definitely don't want to do is what you'll see on line 104
at http://batiste.dosimple.ch/blog/posts/2007-09-11-1/jquery.rte.js (a
ton of HTML is assigned to $.fn.rte.toolbar.tb).