DOM manipulation methods are discussed in detail in Chapter 5.
Method |
Description |
---|---|
|
Get the attribute named |
|
Set the attribute named |
|
Set the attribute named |
|
Set attribute values, given as key-value pairs. |
|
Remove the attribute named |
|
Add the given class to each matched element. |
Remove the given class from each matched element. | |
|
Remove the given class if present, and adds it if not, for each matched element. |
|
Return |
Get the HTML content of the first matched element. | |
|
Set the HTML content of each matched element to |
|
Get the textual content of all matched elements as a single string. |
|
Set the textual content of each matched element to |
|
Get the value attribute of the first matched element. |
|
Set the value attribute of each element to |
|
Get the CSS attribute named |
|
Set the CSS attribute named |
|
Set CSS attribute values, given as key-value pairs. |
|
Get the top, and left, pixel coordinates of the first matched element, relative to the viewport. |
|
Get the top, and left, pixel coordinates of the first matched element, relative to the element returned by |
|
Get the vertical scroll position of the first matched element. |
|
Set the vertical scroll position of all matched elements to |
|
Get the horizontal scroll position of the first matched element. |
|
Set the horizontal scroll position of all matched elements to |
|
Get the height of the first matched element. |
|
Set the height of all matched elements to |
|
Get the width of the first matched element. |
|
Set the width of all matched elements to |
|
Get the height of the first matched element, including padding, but not border. |
Get the width of the first matched element, including padding, but not border. | |
Get the height of the first matched element, including padding, border, and optional margin. | |
|
Get the width of the first matched element, including padding, border, and optional margin. |
|
Insert |
|
Insert the matched elements at the end of the interior of the elements matched by |
|
Insert |
|
Insert the matched elements at the beginning of the interior of the elements matched by |
|
Insert |
|
Insert the matched elements after each of the elements matched by |
|
Insert |
|
Insert the matched elements before each of the elements matched by |
|
Wrap each of the matched elements within |
|
Wrap all of the matched elements as a single unit within |
|
Wrap the interior contents of each of the matched elements within |
|
Replace the matched elements with |
Replace the elements matched by | |
|
Remove the child nodes of each matched element. |
Remove the matched nodes (optionally filtered by | |
|
Make a copy of all matched elements, optionally also copying event handlers. |
|
Get the data item named |
|
Set the data item named |
|
Remove the data item named |