jQuery:意外的令牌ILLEGAL

chu*_*ley 2 html javascript jquery append

无法找到我的问题的解决方案所以我会在这里问.

当我插入jQuery文件时,我在第2行遇到错误:意外的令牌ILLEGAL

码:

jQuery(document).ready(function(){
    $('body').append('
        <div id="style_selector">
        <div id="style_selector_container">
        // another chunk of code
        </div><!-- #style_selector end -->');
});
Run Code Online (Sandbox Code Playgroud)

先感谢您

Dee*_*epu 6

jQuery(document).ready(function(){
    $('body').append('<div id="style_selector"><div id="style_selector_container"></div>');
});
Run Code Online (Sandbox Code Playgroud)

这将完成工作.因为当您使用jquery附加内容时,它不能包含新行.