Search code examples
jqueryfirebugjquery-templates

Firebug doesn't load jQuery templates


First off I need to change my script tag from "text/html" to "text/javascript" to be able to load the scripts with firebug. Now Firebug gives me the error message: XML can't be the whole program. My template looks like this:

     <script id="preview" type="text/javascript">
          <div style="width:${Width};height:${Height}" class='brick'>
            <img src="${Image}" width="${Width}" height="${Height}"/>
         </div>
     </script>

But I don' want to change my script tag to "text/javascript"?


Solution

  • The $.tmpl() plugin requires inline templates to have the type text/x-jquery-tmpl like this:

    <script id="preview" type="text/x-jquery-tmpl">
        <div style="width:${Width};height:${Height}" class='brick'>
            <img src="${Image}" width="${Width}" height="${Height}"/>
         </div>
    </script>
    

    That should fix your issue; I hope this helps!