plainJS

Functions / Manipulation

Manipulation

Manipulating DOM elements. 12 snippets.

  1. Append or prepend to an element$.append(), $.appendTo(), $.prepend(), $.prependTo()
  2. Clone an element$.clone()
  3. Create a DOM element$(string)
  4. Empty an element’s content$.empty()
  5. Get and set the HTML content of an element$.html()
  6. Get the text content of an element$.text()
  7. Insert an element after or before another$.after(), $.before(), $.insertAfter(), $.insertBefore
  8. Iterating over a list of selected elements$.each()
  9. Removing an element$.remove(), $.detach()
  10. Replace a DOM element$.replaceAll(), $.replaceWith()
  11. Unwrap a DOM element$.unwrap()
  12. Wrap an HTML structure around an element$.wrap(), $.wrapAll()

The other groups: