jQuery .append()

jQuery .append() inserts content to the end of the target; difference between .append() and .appendTo();

js:


$(function() {

    $('div').append($('<strong> - append text</strong>'));

    $('p').append($('<strong>').attr('title', 'text title attr').text(' - append text with title attr'));

});​

html:


<div>div</div>

<p>paragraph</p>​

Leave a Comment