Web Development with jQuery®

(Elliott) #1

Appendix F (^) ❘ 529
bapp06.indd 02/17/2015 Page 529
clone(
[withDataAndEvents],
[deepWithDataAndEvents]
)
Clones the selected elements; returns the
jQuery object including the clones you cre-
ated. If the optional withDataAndEvents
argument is true, then events and data are
cloned as well.
If the optional second argument is provided,
the deepWithDataAndEvents argument
controls whether children elements also have
their events and data cloned. By default, this
argument matches whatever is provided for
the fi rst value. The fi rst value’s default value
is false.
jQuery
detach([selector]) Removes the selected elements from the
DOM. This method keeps jQuery data for the
associated elements around, which can be
useful when it is desired to reinsert the ele-
ments in the DOM at a later time.
jQuery
empty() Removes all child nodes from the selected
elements.
jQuery
insertAfter(selector) Inserts the selected elements after the ele-
ments specifi ed by the selector argument.
jQuery
insertBefore(selector) Inserts the selected elements before
the selectors specifi ed by the selector
argument.
jQuery
prepend(content[,
content])
Prepends the specifi ed content before any
existing content for each selected element.
One or more content items can be specifi ed
for inclusion and will be inserted sequentially.
Content items can be an HTML snippet, a
DOM element object reference, or a jQuery
object.
jQuery
prepend(function()) Executes a function that returns content to
be prepended. The content returned by the
function can be an HTML string, a DOM ele-
ment object reference, an Array of DOM ele-
ment object 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
continues
http://www.it-ebooks.info

Free download pdf