Web Development with jQuery®

(Elliott) #1

(^530) ❘ APPENDIX F MORE CONTENT MANIPULATION
bapp06.indd 02/17/2015 Page 530
prependTo(selector) Prepends all the selected elements to
the elements specifi ed by the selector
argument.
jQuery
remove([selector]) Removes the selected elements from the
DOM. An optional selector can be provided
to further fi lter the selection.
jQuery
replaceAll(selector) Replaces the elements specifi ed in the
selector argument with the selected
elements.
jQuery
replaceWith(content) Replaces each selected element(s) with the
specifi ed HTML or DOM element(s). This
method returns the jQuery object, which
includes the element that was replaced.
jQuery
replaceWith(function()) A callback function that returns content that
will replace the selected elements. The con-
tent returned by the callback function can be
an HTML snippet, a DOM element reference,
an Array of DOM element references, or a
jQuery object.
As with most jQuery callback functions, this
refers to the current element within the call-
back function, and the callback function is
provided with the argument list: offset,
html.
jQuery
unwrap() Removes the selected element(s) parent
element.
jQuery
wrap(wrappingElement) Wraps each selected element with the speci-
fi ed element. The element can be a selector
referencing another element, an HTML snip-
pet, a DOM element object reference, or a
jQuery object.
Note the distinction that the element must
be capable of wrapping another element—
for example, you couldn’t use an
element to wrap another element.
jQuery
(continued)
http://www.it-ebooks.info

Free download pdf