What is better, appending new elements via DOM functions, or appending strings with HTML tags?

后端 未结 6 1130
无人共我
无人共我 2020-11-29 05:34

I have seen a few different methods to add elements to the DOM. The most prevelent seem to be, for example, either

document.getElementById(\'foo\').innerHTM         


        
6条回答
  •  清歌不尽
    2020-11-29 05:52

    According to this benchmark data, you will receive much faster results with innerHTML than creating DOM elements. It's especially clear when using older IE versions.

提交回复
热议问题