<分区>
Possible Duplicate:
How to outsource a template js to a different file when using Handlebars.js
我正在使用 Handlebars 。他们建议像这样在文档正文中包含模板:
<script id="entry-template" type="text/x-handlebars-template">
template content
</script>
我想通过 src 属性使用模板内容,并将我的模板(大量)存储在单独的文件中。
<script src="/path/to/my.template" id="entry-template" type="text/x-handlebars-template"></script>
问题是如何访问它的共同内容?
$('script#entry-template').html() //returns ""
$('script#entry-template').text() //returns ""