【发布时间】:2016-01-11 04:09:14
【问题描述】:
我是 underscore.js 和 jquery 的初学者,当我创建一个简单的模板时,如下所示:
<html>
<body>
<script src="E:/its me/softies/blackhole.com/underscore.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type ="text/javascript" id="tem">
var head = "hii";
//var head2 = "hello";
var templ = _.template($('#temp').html()) ;
$('#tagent').append(templ,{head:head});
</script>
<script type="text/template" id="temp">
<h1><%=head></h1>
<h2><%=head2></h2>
</script>
<div class="tangent"></div>
</body>
它显示一个错误:Uncaught TypeError: Cannot read property 'replace' of undefined
我使用括号编辑器。如果有人能告诉我,我将不胜感激
1)这是什么错误?
2)我哪里出错了?? .非常感谢。
【问题讨论】:
标签: javascript jquery underscore.js