jQuery Add Elements

append, prepend, after, before.

jQuery Add Elements

With jQuery, it is easy to add new elements/content.

Four Methods to Add New Content:

  • append() - Inserts content at the END of the selected elements
  • prepend() - Inserts content at the BEGINNING of the selected elements
  • after() - Inserts content AFTER the selected elements
  • before() - Inserts content BEFORE the selected elements

Example

$("p").append("Some appended text.");