jquery - When adding JavaScript data to a page what's more efficient: creating new elements or populating existing ones? -


i have page i'm adding api response data creating new html elements data.

should creating html elements on page , them via script populate them?

is less efficient create them in js or not matter?

thanks

changing contents of element, or appending element?

both cases requires redraw in cases, right answer efficient solution if need change many elements, create elements in documentfragment, , append them dom in 1 go, instead of changing contents of many elements existing in dom, requiring redraw each manipulation.

as sidenote, cloning elements faster creating new ones.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -