title: Loading Underscore templates in HTML
body: <p>I am trying to load templates from a file into an HTML file using a script tag. I want to use this as a template in UnderscoreJS - but I'm not able to load the file:</p>
  
  <pre><code>//main.js
  
      this.template = _.template($("#add-question").html());
              console.log("testing");
              console.log(this.template({
                  question: "How are you doing?",
                  yesOrNo: true
              }))
  
  //console output:
  
      testing      Main.ts:37
                   Main.ts:38
  
  
      //main html file:
  
      &lt;html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html"&gt;
      &lt;head&gt;
          &lt;script type="text/template" id="add-question" src="client/add-new-question.html"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="https://rawgithub.com/jashkenas/underscore/master/underscore-min.js"&gt;&lt;/script&gt;
      &lt;script data-main="main.js" src="build/require.js"&gt;&lt;/script&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>// client/add-new-question.html</p>
  
  <pre><code>    &lt;form id="testForm"&gt;
          &lt;span&gt;"&lt;% question %&gt;&lt;/span&gt;
          &lt;input id="questionInput" type="text"&gt;
          &lt;span&gt;"&lt;% yesOrNo %&gt;&lt;/span&gt;
          &lt;input id="typeInput" type="checkbox"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p><strong>Update:</strong>
  Here's the updated HTML in in which I've tried loading the html though a script tag in the body. Still doesn't work. This is how its expected to be done when rendering the template with UnderscoreJS. I want to be able to load the template with requireJS but render it using the underscoreJS template function.</p>
  
  <pre><code>&lt;body&gt;
  &lt;script type="text/template" id="add-question"&gt;
      &lt;form id="testForm"&gt;
          &lt;span&gt;"&lt;%= question %&gt;&lt;/span&gt;
          &lt;input id="questionInput" type="text"&gt;
          &lt;span&gt;"&lt;%= yesOrNo %&gt;&lt;/span&gt;
          &lt;input id="typeInput" type="checkbox"&gt;
      &lt;/form&gt;
  &lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="https://rawgithub.com/jashkenas/underscore/master/underscore-min.js"&gt;&lt;/script&gt;
  &lt;script data-main="main.js" src="build/require.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  </code></pre>