BorisMoore / jquery-tmpl

The original official jQuery Templates plugin. This project was maintained by the jQuery team as an official jQuery plugin. It is no longer in active development, and has been superseded by JsRender.
3.23k stars 1.01k forks source link

$obj.tmpl().html() can not return whole html , i need a method to return this dom's whoe html ? #191

Closed tomatobybike closed 7 years ago

tomatobybike commented 7 years ago
<script id="companyTmpl" type="text/x-jquery-tmpl">
  country:${country}
  <div> sex:${sex}</div>
${age}
</script>

<script id="companyTmpl" type="text/x-jquery-tmpl">
  $(function() {
  var template="<div>${name}</div><div style="background:#ccc;">${infos}</div>";
    $.template("templateList", template);
    var data={
      name:"lucy"
    }
    data.infos=$("#companyTmpl").tmpl({country:"USA",sex:"girl",age:"18"}).html();
    $.tmpl('templateList',data).appendTo('#dataCompany');

  });
</script>

$obj.tmpl() , i need a method to return this dom's whole html ? $obj.tmpl().html() can not return whole html

BorisMoore commented 7 years ago

jQuery templates (jquery-tmpl) are no longer supported or maintained. I strongly encourage you to switch to JsRender, which is more powerful, more performant, fully supported, and has simpler APIs. http://www.jsviews.com/#jsr-quickstart

tomatobybike commented 7 years ago

@BorisMoore ok,thanks,i will try

tomatobybike commented 7 years ago

@BorisMoore $("#companyTmpl").tmpl({country:"USA",sex:"girl",age:"18"}).wrapAll('div').parent().html(); can get all html ,i'll read the jsviews todady ,thank you