Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7073535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:56:28+00:00 2026-05-28T05:56:28+00:00

this is my html: <script type=text/html id=ul-template> <ul id=list> {{> li-templ}} </ul> </script> <script

  • 0

this is my html:

<script type="text/html" id="ul-template">
    <ul id="list">
        {{> li-templ}}
    </ul>
</script>  

<script type="text/html" id="ul-template2">
    <div id="list2">
        {{> li-templ}}
    </div>
</script>    

<script type="text/html" id="li-templ">
    <p>{{ name }}</p>
</script>  

as you can see, I want to reuse the #li-templ part, but it seems that I have to write it into a file called li-templ.mustache then I can include it as partial?
can I just define them in the single html file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:56:29+00:00Added an answer on May 28, 2026 at 5:56 am

    I’m assuming you’re using the JS flavor of Mustache.

    In mustache.js an object of partials may be passed as the third argument to Mustache.render. The object should be keyed by the name of the partial, and its value should be the partial text.

    You need to:

    1. Define some dummy data for name
    2. Get your partial template by getting the HTML of #li-templ
    3. Create an object with the name of the partial (li-templ) as the key
    4. Tell Mustache to render each template with the view data including your partial

    Here’s some jQuery to do just that:

    var view = {"name" : "You"},
    li = $('#li-templ').html(), 
    partials = {"li-templ": li},
    ul1 = Mustache.to_html($('#ul-template').html(), view, partials),
    ul2 = Mustache.to_html($('#ul-template2').html(), view, partials);;
    
    document.write(ul1, ul2);
    

    Here’s a jsFiddle of it all working- http://jsfiddle.net/maxbeatty/EYDfP/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

look at this code, <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> <script> function change() {
Take a look at this html: <head> <title>Test page</title> <script type=text/javascript> function submitForm() {
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
Here are the problem scripts: This is from the HTML file: <script type=text/javascript> var
Given this markup: // Calendar.html?date=1/2/2003 <script> $(function() { $('.inlinedatepicker').datepicker(); }); </script> ... <div class=inlinedatepicker
<HTML> <HEAD> <title>Login</title> <script type=text/javascript src=http://script.auction.co.kr/common/jquery.js></script> <script type=text/javascript> $(document).ready(function() { $(:input[name='txtPassword']).blur(function(e){ $(this).css(background-color,white); }); $(:input[name='txtPassword']).focus(function(e){
I'm attempting to select all <script type=text/html> tags in a page. I use <script>
I've got the following in my <head> section: <script type=text/javascript> $(function(){ $(h5).live(click, function(){ alert($(this).tmplItem());
I am using this HTML <html> <head> <Title>EBAY Search</title> </head> <script language=JavaScript src=ajaxlib.js></script> <body>
I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.