Category: Manipulation


All of the methods in this section manipulate the DOM in some manner. A few of them simply change one of the attributes of an element (also listed in the Attributes category), while others set an element's style properties (also listed in the CSS category). Still others modify entire elements (or groups of elements) themselves—inserting, copying, removing, and so on. All of these methods are referred to as "setters," as they change the values of properties.
A few of these methods—such as .attr(), .html(), and .val()—also act as "getters," retrieving information from DOM elements for later use.

Also in: CSS

.addClass()

Adds the specified class(es) to each element in the set of matched elements.

Also in: DOM Insertion, Outside

.after()

Insert content, specified by the parameter, after each element in the set of matched elements.

Also in: DOM Insertion, Inside

.append()

Insert content, specified by the parameter, to the end of each element in the set of matched elements.

Also in: DOM Insertion, Inside

.appendTo()

Insert every element in the set of matched elements to the end of the target.

Also in: General Attributes

.attr()

Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.

Also in: DOM Insertion, Outside

.before()

Insert content, specified by the parameter, before each element in the set of matched elements.

Also in: Copying

.clone()

Create a deep copy of the set of matched elements.

Also in: Style Properties

.css()

Get the value of a computed style property for the first element in the set of matched elements or set one or more CSS properties for every matched element.

Also in: DOM Removal

.detach()

Remove the set of matched elements from the DOM.

Also in: DOM Removal

.empty()

Remove all child nodes of the set of matched elements from the DOM.

Also in: CSS

.hasClass()

Determine whether any of the matched elements are assigned the given class.

Also in: Style Properties

.height()

Get the current computed height for the first element in the set of matched elements or set the height of every matched element.

Also in: DOM Insertion, Inside

.html()

Get the HTML contents of the first element in the set of matched elements or set the HTML contents of every matched element.

Also in: Style Properties

.innerHeight()

Get the current computed inner height (including padding but not border) for the first element in the set of matched elements or set the inner height of every matched element.

Also in: Style Properties

.innerWidth()

Get the current computed inner width (including padding but not border) for the first element in the set of matched elements or set the inner width of every matched element.

Also in: DOM Insertion, Outside

.insertAfter()

Insert every element in the set of matched elements after the target.

Also in: DOM Insertion, Outside

.insertBefore()

Insert every element in the set of matched elements before the target.

Also in: Style Properties

jQuery.cssNumber

An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values.

jQuery.htmlPrefilter()

Modify and filter HTML strings passed through jQuery manipulation methods.

Also in: Style Properties

.offset()

Get the current coordinates of the first element, or set the coordinates of every element, in the set of matched elements, relative to the document.

Also in: Style Properties

.outerHeight()

Get the current computed outer height (including padding, border, and optionally margin) for the first element in the set of matched elements or set the outer height of every matched element.

Also in: Style Properties

.outerWidth()

Get the current computed outer width (including padding, border, and optionally margin) for the first element in the set of matched elements or set the outer width of every matched element.

Also in: Style Properties

.position()

Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.

Also in: DOM Insertion, Inside

.prepend()

Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.

Also in: DOM Insertion, Inside

.prependTo()

Insert every element in the set of matched elements to the beginning of the target.

Also in: General Attributes

.prop()

Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.

Also in: DOM Removal

.remove()

Remove the set of matched elements from the DOM.

Also in: General Attributes

.removeAttr()

Remove an attribute from each element in the set of matched elements.

Also in: CSS

.removeClass()

Remove a single class, multiple classes, or all classes from each element in the set of matched elements.

Also in: General Attributes

.removeProp()

Remove a property for the set of matched elements.

Also in: DOM Replacement

.replaceAll()

Replace each target element with the set of matched elements.

Also in: DOM Replacement

.replaceWith()

Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.

Also in: Style Properties

.scrollLeft()

Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element.

Also in: Style Properties

.scrollTop()

Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.

Also in: DOM Insertion, Inside

.text()

Get the combined text contents of each element in the set of matched elements, including their descendants, or set the text contents of the matched elements.

Also in: CSS

.toggleClass()

Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the state argument.

Also in: DOM Removal

.unwrap()

Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.

Also in: General Attributes

.val()

Get the current value of the first element in the set of matched elements or set the value of every matched element.

Also in: Style Properties

.width()

Get the current computed width for the first element in the set of matched elements or set the width of every matched element.

Also in: DOM Insertion, Around

.wrap()

Wrap an HTML structure around each element in the set of matched elements.

Also in: DOM Insertion, Around

.wrapAll()

Wrap an HTML structure around all elements in the set of matched elements.

Also in: DOM Insertion, Around

.wrapInner()

Wrap an HTML structure around the content of each element in the set of matched elements.