Appending large block of html with append()

后端 未结 11 953
-上瘾入骨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:28

    It's my understanding that if you want to put your long string on multiple lines that it's more efficient to use an array of strings and join them.

    var bigString = [
        'some long text here',
        'more long text here',
        '...'
    ];
    $('#accordion_container').append(bigString.join(''));
    

提交回复
热议问题