Questions tagged [jquery-append]

Refers to jQuery's append function, which allows you to insert content as the last child of the matched elements.

The .append() function inserts content, specified by the parameter, to the end of each element in the set of matched elements.

// added in version 1.0
$(selector).append( content [, content ] );

// added in version 1.4
$(selector).append( function );

Example usage:

Given this DOM:

<div>
    <p>First paragraph</p>
</div>

The append function can be used to add a new p tag to the end of it:

$('div').append('<p>New paragraph</p>');

For a result of:

<div>
    <p>First paragraph</p>
    <p>New paragraph</p>
</div>

Resource

75 questions
1
vote
1 answer

Why I can't correctly append a tag having the id specified? Is it a character escaping problems?

I am pretty new in JavaScript and Jquery and I have the following problem that I think could be related to some character escaping. So I have this simple JQuery script: