2

could not find a solution to my problem so i'll ask here.

When i insert jQuery file, i get an error on line 2: unexpected token ILLEGAL

Code:

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

Thank you in advance

chuckfinley
  • 2,527
  • 10
  • 30
  • 41
  • 5
    JavaScript does not support multi-line strings like this. Either put it on one line or escape the end with ``\``. – Felix Kling May 05 '13 at 14:27

1 Answers1

6
jQuery(document).ready(function(){
    $('body').append('<div id="style_selector"><div id="style_selector_container"></div>');
});

This will do the job.Because while you are appending a content using jquery it must not contains new line.

Deepu
  • 11,587
  • 13
  • 55
  • 88