jQuery difference between .add() and .append()

  • 0

.add()
Add elements to the set of matched elements.
$('div').css('background-color':'yellow').add('p').css('color':'red');



.append()
Insert content, specified by the parameter, to the end of each element in the set of matched elements.
$('div').append('p');


Reference: whats-the-difference-between-add-and-append-jquery

沒有留言 :

張貼留言