Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

jQuery.load() for Handlebars.js

$
0
0

In all my pages I am loading the header with this script:

<script>
    $("header:first-of-type").load("./pages/common/header.handlebars");
</script>

But if I have a mustache expression such as:

//header.handlebars
{{#if msg}}
    <h1 class="msg">{{msg}}</h1>
{{/if}}

The page will treat it as text and render it like {{#if msg}}...{{/if}}. Is there any alternative to jQuery.load() which could compile it? I've read the docs, but I am just starting out with Handlebars and JS+jQuery in general, so any help regarding specifically what I have to type in place of $().load() would be greatly appreciated.


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>