Appending large block of html with append()

后端 未结 11 941
-上瘾入骨i
-上瘾入骨i 2021-01-31 10:09

Im trying to append a large block of text using jquery\'s append().

$(\'#add_contact_btn\').click(function(event) {
    event.preventDefault();

    var large =         


        
11条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 10:20

    You can use a backslash at the end of each line.

    http://davidwalsh.name/multiline-javascript-strings

    var multiStr = "This is the first line \
    This is the second line \
    This is more...";
    

提交回复
热议问题