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 356267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:05:44+00:00 2026-05-12T12:05:44+00:00

So I know there is a few templating engines out there, but I thought

  • 0

So I know there is a few templating engines out there, but I thought I’d ask for someones experience and reccomendation on one that can do what I’m after.

I’d previously made an (intranet) web app that used asp.net editable listviews to take input and used an update panel to make it persist the data regularly (save)

This worked ok but was alot of hackery to get focus to maintain on the ajax postback amongst other things. This is because update panels rewrite the whole section of html on each ajax postback.

So I figured for some more control and a better user experience (and quicker speeds) I’d try a jquery/javascript based templating engine. What i’m doing is making a sort of to do list (its more than that but lets just keep it simple for this example) where someoen fills out a line with an action, due date, and some other fields.

I liked John Resigs Microtemplating engine so I used that. However after working it all out it seems that it re-writes the whole javascript template each time it updates, which is just what I was trying to avoid, as it loses the users focus. I was hoping for something that would just append things onto the end – why do they need to rewrite everything?? I could do as I did with the udpate panel and use some hacking based on the current focus but I would rather avoid this and make it seamless.

am I going to have to manually code this up, or is there a decent way of doing it out there?

  • 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-12T12:05:44+00:00Added an answer on May 12, 2026 at 12:05 pm

    Resig’s Microtemplating is great. However, like most client-side templating engines all it gives you is a string. How you get that string into the DOM is up to you.

    Why do they need to rewrite everything?

    The templating engine is not overwriting anything. Rather that is being done by you (however it is you are putting it into the DOM). For example:

    var template = Template('template_id');
    
    // The template engine simply generates a string:
    var generatedHtml = template({data:'goes here'});
    
    // The engine's work is done at this point.  
    
    // Now lets get the string into the DOM:
    myElement.innerHTML = generatedHtml; // OVERWRITES
    

    I was hoping for something that would just append things onto the end

    Since you are using jQuery it is trivial to append rather than overwrite. Instead of the innerHTML line above you would use jQuery’s append method:

    $(myElement).append(generatedHtml);
    

    Now, regarding your focus problem, again this is not strictly due to the template engine but rather the nature of DOM manipulation in general. The solution is to force the element you need to have focus to focus:

    Lets say your template looked like this, in Resig’s microtemplating parlance:

    <script type="text/html" id="template_id">
    Foo: <input type="text" value="<%= data %>" />
    </script>
    

    Continuing the JavaScript example of prior, you focus like this:

    $(myElement).append(generatedHtml);
    
    // Focus the just inserted text box:
    $(myElement).find('input').focus();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are a few questions out there but I've tried a lot
I know there are a few regex/ lastIndex discrepancies but this one is new
I know there are a few questions on this already but I can't seem
I know there are a few frameworks to parse JSON, but how can I
I know that there are a few similar questions and I googled a lot
I know how to use locks in my app, but there still few things
Anyone know? I found a few answers, but there were too complex and going
I know there are a few things you can do directly with a variable,
I know there are a few questions floating around here on the subject, but
I know there are a few questions regarding the libraries you can use to

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.