所以我想写一个函数来返回列表元素,其中包含很少的东西,即
function generateSurpriseMe(month) {
var surprise = $('
<li class="queue-month">
<h3>'+ month +'</h3>
...
</li>
');
return surprise;
}
Run Code Online (Sandbox Code Playgroud)
其中month是一个需要插入的参数(它不是唯一的参数,但为了保持这个简单,我只会包含它).但我在控制台中收到"意外令牌ILLEGAL"错误,无法弄清楚它是什么,错误推荐给第二行代码var surprise = $('
多行字符串应该以 \
var surprise = $('\
\
<li class="queue-month">\
<h3>'+ month +'</h3>\
...\
</li>\
\
');
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅此
| 归档时间: |
|
| 查看次数: |
32 次 |
| 最近记录: |