jquery-tmpl
                                
                                
                                
                                    jquery-tmpl copied to clipboard
                            
                            
                            
                        API to return html as string
is it possible to have a function call to return the resulting html just as a plain string? at the moment i have to use somehting like
   myHtml = $.tmpl($("#templateList").html(), data)
   data = $('<div />').append(myHtml).html();
i would be able to call something like
  myHtml = $.tmplString($("#templateList").html(), data);
                                    
                                    
                                    
                                
you are referring outerHTML feature, which is not natively available in jQuery (and this is not tmpl problem). Although you could use this workaround:
$( .... ).wrapAll( '
Yes, this is a feature we hope to provide in Beta2. See also the following, copied from http://github.com/nje/jquery-tmpl/issues/16
This feature is already available, but not very discoverable:
<script type="text/javascript">
    var somedata = [
        { name: "John", condition:"a>b" },
        { name: "Pete", condition:"b<a" }
    ];
    var tmplFn = $( "#personTmpl" ).template();
    var xmlResult = $.map( somedata, function( item ) {
        return tmplFn( $, { data: item } );
    }).join("");
</script>
Of course, although the above is reasonably easy to use, it is not at all discoverable. We should consider providing a discoverable API for this.
Note that calling tmpl() does indeed create DOM elements, and even adds jQuery data expandos to them, so even if you get the HTML string of the result, it will not be clean.
The above approach does not use the DOM at all, and so can also run on the server, etc. For attribute strings you may have characters that would be HTML encoded (as in my example above), so the {{html foo}} tag is appropriate in the template, rather than ${foo}.
Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.
See issue 159.