无法使用jQuery创建嵌套元素

Ilj*_*lja 0 javascript jquery

所以我想写一个函数来返回列表元素,其中包含很少的东西,即

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 = $('

SDe*_*kov 5

多行字符串应该以 \

var surprise = $('\
\
    <li class="queue-month">\
        <h3>'+ month +'</h3>\
        ...\
    </li>\
 \
');
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅