jQuery DOM Methods

About This Index
This page is the jQuery DOM index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn the jQuery overview on /jquery. Use this page when you need a DOM API such as .append(), .html(), or .detach().
Start with .append() and .html(), then .text() and .remove()—learn .detach() when you need to stash nodes and put them back later.
How to Call a DOM Method
Insert, rewrite content, or remove nodes from a jQuery collection:
$("#list").append("Item ");
$("First ").prependTo("#list");
$("#panel").html("Hello
");
$("#panel").text("Plain text only");
var stash = $("#card").detach();
stash.appendTo("#shelf");
$("#old").replaceWith("");
$("p").wrap(""); jQuery DOM Methods Table
All DOM method guides in this jQuery tutorial series (29 tutorials).
Insert Content
13 methodsAdd, move, and rearrange nodes — append, prepend, siblings, and replace.
| Method | Description | Tutorial |
|---|---|---|
.append() | Insert content as the last child of each matched element. | Try it |
.appendTo() | Insert matched elements at the end of a target — reversed .append(). | Try it |
.prepend() | Insert content as the first child of each matched element. | Try it |
.prependTo() | Insert matched elements at the start of a target — reversed .prepend(). | Try it |
.after() | Insert content immediately after each matched element as a sibling. | Try it |
.before() | Insert content immediately before each matched element as a sibling. | Try it |
.insertAfter() | Insert matched elements after a target — reversed .after(). | Try it |
.insertBefore() | Insert matched elements before a target — reversed .before(). | Try it |
.html() | Get or set HTML contents — getter reads the first match; setter replaces children. | Try it |
.text() | Get or set plain text contents — safer than .html() for user strings. | Try it |
.replaceWith() | Replace matched elements with new content and return the removed set. | Try it |
.replaceAll() | Replace target elements with matched elements — reversed .replaceWith(). | Try it |
.clone() | Create a deep copy of matched elements — optionally with data and events. | Try it |
Wrap & Unwrap
4 methodsAdd or strip parent wrappers around matched elements.
| Method | Description | Tutorial |
|---|---|---|
.wrap() | Wrap an HTML structure around each matched element. | Try it |
.wrapAll() | Wrap all matched elements together in a single parent container. | Try it |
.wrapInner() | Wrap the contents inside each matched element. | Try it |
.unwrap() | Remove the immediate parent and leave matched elements in place. | Try it |
Remove & Preserve
3 methodsTake elements out of the document — detach for temporary removal, remove for permanent.
Element Data
3 methodsStore, check, and clear arbitrary JavaScript data on DOM elements.
| Method | Description | Tutorial |
|---|---|---|
.data() | Store and read arbitrary values on elements — keys, objects, or data-* seeding. | Try it |
.removeData() | Remove values from jQuery's internal data cache. | Try it |
$.hasData() | Return true if an element has jQuery data or event handlers cached. | Try it |
Visibility
3 methodsShow, hide, and toggle element visibility (also covered under Effects).
Document Ready
1 methodPromise-style DOM ready via the $.ready thenable.
Collection Helpers
2 methodsInspect or convert the jQuery collection itself.
| Method | Description | Tutorial |
|---|---|---|
.toArray() | Convert the jQuery collection into a native DOM element array. | Try it |
.size() | Deprecated alias for .length — prefer .length on the collection. | Try it |
Frequently Asked Questions
Start with .append()
Open the insert guide—syntax, examples, and FAQs.
16 people found this page helpful
