Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Dec 31st, 2010  |  syntax: JavaScript  |  size: 0.53 KB  |  hits: 524  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <script id="parent-tmpl" type="text/x-jquery-tmpl">
  2.         <div id="parent">
  3.                 <p>{{= value}}</p>
  4.                 {{tmpl "#child"}}
  5.         </div>
  6. </script>
  7.  
  8. <script id="child" type="text/x-jquery-tmpl">
  9.         <div class="stuff">
  10.         </div>
  11. </script>
  12.  
  13. <script id="item" type="text/x-jquery-tmpl">
  14.         <p>{{= another_value}}</p>
  15. </script>
  16.  
  17. <script type="text/javascript">
  18.         // Change the value
  19.         var tmpl_item = jQuery("#parent").tmplItem();
  20.         tmpl_item.data.value = "new value";
  21.         tmpl_item.update();
  22.         // #parent-tmpl > div.stuff will now be empty!
  23. </script>