Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

and

$('#somDiv').html('text To Insert')

?

like image 287
AppleTrue Avatar asked Dec 14 '09 19:12

AppleTrue


1 Answers

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

Source: jQuery source.

like image 179
Roatin Marth Avatar answered Sep 20 '22 15:09

Roatin Marth