Skip to content
didier Belot edited this page Mar 6, 2018 · 2 revisions

Example

pq('div.old')->replaceWith( pq('div.new')->clone() )
    ->appendTo('.trash')
    ->prepend('Deleted')->...

Table of Contents

Changing Contents

  • html() Get the html contents (innerHTML) of the first matched element. This property is not available on XML documents (although it will work for XHTML documents).
  • html($val) Set the html contents of every matched element. This property is not available on XML documents (although it will work for XHTML documents).
  • text() Get the combined text contents of all matched elements.
  • text($val) Set the text contents of all matched elements.

Inserting Inside

Inserting Outside

Inserting Around

  • wrap($html) Wrap each matched element with the specified HTML content.
  • wrap($elem) Wrap each matched element with the specified element.
  • wrapAll($html) Wrap all the elements in the matched set into a single wrapper element.
  • wrapAll($elem) Wrap all the elements in the matched set into a single wrapper element.
  • wrapInner($html) Wrap the inner child contents of each matched element (including text nodes) with an HTML structure.
  • wrapInner($elem) Wrap the inner child contents of each matched element (including text nodes) with a DOM element.

Replacing

Removing

  • empty() Remove all child nodes from the set of matched elements.
  • remove($expr) Removes all matched elements from the DOM.

Copying

  • clone() Clone matched DOM Elements and select the clones.
  • clone($true) Clone matched DOM Elements, and all their event handlers, and select the clones.

Read more at Manipulation section on jQuery Documentation Site.

Clone this wiki locally