jQuery appending an array of elements

后端 未结 9 711
星月不相逢
星月不相逢 2020-12-13 23:34

For the purpose of this question lets say we need to append() 1000 objects to the body element.

You could go about it like this:

         


        
9条回答
  •  感情败类
    2020-12-13 23:59

    I know, the question is old, but maybe it helps others.

    Or simple use ECMA6 spread operator:

    $('body').append(...elements);
    

提交回复
热议问题