O'Reilly logo

Learning jQuery Third Edition by Karl Swedberg, Jonathan Chaffer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DOM manipulation methods in a nutshell

The extensive DOM manipulation methods that jQuery provides vary according to their task and their target location. We haven't covered them all here, but most are analogous to the ones we've seen, and more will be discussed in Chapter 12. The following outline can serve as a reminder of which method we can use to accomplish which task:

  1. To create new elements from HTML, use the $() function.
  2. To insert new element(s) inside every matched element, use:
    • .append()
    • .appendTo()
    • .prepend()
    • .prependTo()
  3. To insert new element(s) adjacent to every matched element, use:
    • .after()
    • .insertAfter()
    • .before()
    • .insertBefore()
  4. To insert new element(s) around every matched element, use:
    • .wrap()
    • .wrapAll()
    • .wrapInner()
  5. To replace every matched ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required