Appending large block of html with append()

后端 未结 11 942
-上瘾入骨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条回答
  •  梦毁少年i
    2021-01-31 10:25

    If line-breaks are an issue just use innerHTML, works in every browser since IE5:

    $('#accordion_container')[0].innerHTML += large;​
    

    Or, for collections:

    $('.accordion_container').forEach(function () {
        this.innerHTML += large;​
    });
    

提交回复
热议问题