The following table lists all the methods used to manipulate the DOM.
The methods below work for both HTML and XML documents. Exception: the html() method.
The methods below work for both HTML and XML documents. Exception: the html() method.
Method | Description |
---|---|
addClass() | Adds one or more classes (for CSS) to selected elements |
after() | Inserts content after selected elements |
append() | Inserts content at the end of (but still inside) selected elements |
appendTo() | Inserts content at the end of (but still inside) selected elements |
attr() | Sets or returns an attribute and value of selected elements |
before() | Inserts content before selected elements |
clone() | Makes a copy of selected elements |
detach() | Removes (but keeps a copy of) selected elements |
empty() | Removes all child elements and content from selected elements |
hasClass() | Checks if any of the selected elements have a specified class (for CSS) |
html() | Sets or returns the content of selected elements |
insertAfter() | Inserts HTML markup or elements after selected elements |
insertBefore() | Inserts HTML markup or elements before selected elements |
prepend() | Inserts content at the beginning of (but still inside) selected elements |
prependTo() | Inserts content at the beginning of (but still inside) selected elements |
remove() | Removes selected elements |
removeAttr() | Removes an attribute from selected elements |
removeClass() | Removes one or more classes (for CSS) from selected elements |
replaceAll() | Replaces selected elements with new content |
replaceWith() | Replaces selected elements with new content |
text() | Sets or returns the text content of selected elements |
toggleClass() | Toggles between adding/removing one or more classes (for CSS) from selected elements |
unwrap() | Removes the parent element of the selected elements |
val() | Sets or returns the value attribute of the selected elements (form elements) |
wrap() | Wraps specified HTML element(s) around each selected element |
wrapAll() | Wraps specified HTML element(s) around all selected elements |
wrapInner() | Wraps specified HTML element(s) around the content of each selected element |
No comments:
Post a Comment