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

  • SEARCH
  • Home
  • 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 8232583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:52:53+00:00 2026-06-07T17:52:53+00:00

I use knockout and jQuery.tmpl frameworks in my project and sometimes I use jquery-tmpl

  • 0

I use knockout and jQuery.tmpl frameworks in my project and sometimes I use jquery-tmpl only to generate the HTML like this:

var html = $("#template").tmpl(data);
html.appendTo(destElement);  

I don’t like that somewhere I have knockout templates for binding and somewhere jquery templates for html generation and also for binding.

I would like to know whether knockout provides ability to generate html from template like jquery tmpl does.
If it does, I’ll completely remove the jquery-tmpl, because in most cases I use it only for the html generation from templates.

Please advice

  • 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-06-07T17:52:54+00:00Added an answer on June 7, 2026 at 5:52 pm

    AFAIK Knockout does not support precompiling templates to be stored as a JavaScript variable like jQuery templates does.

    Hence, the example you’ve given in your question is not possible using only the Knockout template binding. The binding does provide some callbacks for post- and after-rendering, however this is not entirely the same as the input for those callbacks are compiled DOM elements rather than JavaScript references to it.

    On our current project we’re using Handlebars as our templating engine, two main reasons why I’d choose this:

    1. jQuery templating is deprecated, no current official plugins exist and the jQuery UI team is unclear when/if they will include templating in the core.
    2. With Handlebars you can extract your templates to separate .handlebars files which can be precompiled from the command line.

    I don’t use the knockout template binding, all my templates are extracted to separate files and are precompiled to separate .js files. All I have to do is to include the compiled .js files and I can access the templates as a JS variable.

    In case you’d choose jQuery templating and wanted to precompile your templates, you’d either have to add all templates to one HTML file and write some JavaScript that will take each template and convert it into JavaScript or you could write up a little node app that takes in your templates, converts them and outputs them again.

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

Sidebar

Related Questions

I have a knockout template like this: <script type=text/html id=list> <ul data-bind=foreach: items> <li
Suppose I have knockout.js template like this: <script type=text/html id=mytemplate> <label for=inputId>Label for input</label>
Let's say I have a template like this <script id=rowTemplate type=text/x-jquery-tmpl> <tr> <a href=${
For some reason knockout requires jquery tmpl when you use databound templates, otherwise it
I have a page that requires jQuery.tmpl, but I want to use native knockout
Does anybody know what will happen to Knockout's default template engine now when jQuery.tmpl
If I have HTML like this: <dsometext<f<legit></legit> whatever What regex pattern do I use
When I use the following jquery template: <script id=cost-template type=text/x-jquery-tmpl> <table class=costSection> <caption class=boldCaption>Costs</caption>
When I use '.pop' or '.remove', knockout automatically removes the elements corresponding in html
I am using Knockout JS in combination with this combobox extension for jQuery: http://source.dellsala.com/jquery-combobox/demo/

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.