O'Reilly logo

Learning jQuery - Fourth 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, Advanced DOM Manipulation. The following outline can serve as a reminder of which method we can use to accomplish which task:

  • To create new elements from HTML, use the $() function
  • To insert new elements inside every matched element, use the following functions:
    • .append()
    • .appendTo()
    • .prepend()
    • .prependTo()
  • To insert new elements adjacent to every matched element, use the following functions:
    • .after()
    • .insertAfter()
    • .before()
    • .insertBefore()
  • To insert new elements around 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