【JavaScript】赋值有回车符时的解决方法
其实用html标签也是可以,个人还是喜欢用script标签。之后用JavaScript或jquery来获取id是template的html内容,然后显示在指定的位置
hello JavaScript模板
[script style="display:none" id="template" type="text/html"]
昵称: {$data.nickname}
注册时间: {$data.intime}
[/script]
(将上面的[]改成对应的<>)
其实用html标签也是可以,个人还是喜欢用script标签。
之后用JavaScript或jquery来获取id是template的html内容,然后显示在指定的位置。
jquery代码
$(function(){
var htmlTemplate = $('#template').html();
$('div.newContent').html(htmlTemplate);
});