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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:28:03+00:00 2026-06-03T03:28:03+00:00

Since Knockout’s individual templates are kept in script tags, I thought that I could

  • 0

Since Knockout’s individual templates are kept in script tags, I thought that I could set the src attribute of the tag and load the HTML from a separate file. Doing so naïvely simply didn’t work, so either

  1. There’s some trick to getting the binding of templates to work with src tag that I need to use
  2. There’s a different way to load templates from different files

(The other two possibilities — 3, all the programmers on this project are expected to modify the same gigantic file, which will be loaded by the browser on start-up, and 4, don’t use Knockoutjs for anything larger than a toy project — I consider equivalent.)

  • 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-03T03:28:05+00:00Added an answer on June 3, 2026 at 3:28 am

    A browser won’t respond to src on anything that has a type other than one of the various ‘javascript’ types and with those it will try to execute the result as a script.

    Several options though:

    • use a template engine that can pull templates remotely (the best one is here: https://github.com/ifandelse/Knockout.js-External-Template-Engine).
    • Loop on your script tags that contain templates and load them up. Something like this would pull the contents using the src as the location. You would need to be careful of when you call applyBindings, if your templates aren’t ready.

      $("script[type='text/html']").each(function(index, el) { $.get($(el).attr("src"),
          function(response) {
              $(el).text(response); });
      }); 
      
    • Here are some other options that I looked at for doing this a while back: http://www.knockmeout.net/2011/03/using-external-jquery-template-files.html

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

Sidebar

Related Questions

Since I started working with JS, I've thought the only way to invoke a
Suppose I have knockout.js template like this: <script type=text/html id=mytemplate> <label for=inputId>Label for input</label>
I have a knockout binding handler that uses plupload for drag and drop and
Since i could not get an exact answer on this question Distance of wgs
Since the last update to PHP5 5.4.0-3 on my Debian box I noticed that
I'm working with a new application at work that we're building out using Knockout.js
Since I'm using Java 1.4.2, this means that I cannot use Java's implementation of
Since Java 5, we've had boxing/unboxing of primitive types so that int is wrapped
Since the keyboard is the interface we use to the computer, I've always thought
Since I'm new to cake, I understand there is a log of magic that

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.