2013-05-05 2 views
2

내 문제에 대한 해결책을 찾을 수 없으므로 여기에서 질문 할 것입니다. 내가 jQuery를 파일을 삽입 할 때jQuery : 예기치 않은 토큰 ILLEGAL

, 난 2 행에 오류가 얻을 : 불법 예기치 않은 토큰을

코드 :

+5

JavaScript는 이와 같이 여러 줄의 문자열을 지원하지 않습니다. 한 줄에 넣거나''\''로 끝을 이스케이프하십시오. –

답변

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

이것은 할 것

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

가 사전에 감사합니다 jquery를 사용하여 콘텐츠를 추가하는 동안 새 줄이 없어야합니다.

관련 문제