Is it possible to use JavaScript inside handlebars.js template

Posted by Gleeb on Stack Overflow See other posts from Stack Overflow or by Gleeb
Published on 2013-06-28T16:52:54Z Indexed on 2013/06/29 10:21 UTC
Read the original article Hit count: 319

Filed under:
|
|

The description says it all. How to put a JavaScript script inside handlebars template.

I want to make a dynamic Paypal button for my website.

      <script type="text/x-mustache-template" id="product-item-thumbnail-template">
      <h2>{{title}}</h2>
      <p>{{message}}</p>
      <p><a class="btn" href="#">View details &raquo;</a></p>
      <p><script src="resources/js-frameworks/[email protected]"
            data-button="buynow"
            data-name="My product"
            data-amount="1.00"></script></p>
</script>

But this produces an error because of the tag. it closes the template script and not the paypal script

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about paypal