What is the difference between .empty().append() and .html()?

前端 未结 6 1223
心在旅途
心在旅途 2020-12-18 08:27

Using jQuery, what\'s the performance difference between using:

$(\'#somDiv\').empty().append(\'text To Insert\')

and

$(\'         


        
6条回答
  •  醉酒成梦
    2020-12-18 09:25

    $('#somDiv').html(value) is equivalent to $('#somDiv').empty().append(value).

    Source: jQuery source.

提交回复
热议问题