Chapter 3. Operating on a jQuery collection

This chapter covers

  • Creating and injecting new HTML elements in the DOM
  • Manipulating a jQuery collection
  • Iterating over the elements of a jQuery collection

In this chapter you’ll discover how to create new DOM elements using the highly flexibile jQuery() function. The need to create new elements will occur frequently in your practice with the library. You’ll find yourself using this capability especially when we start discussing how to inject external data into a web page using JSON and the XML format and jQuery’s methods to work with Ajax.

In addition, you’ll learn other methods that are different from jQuery(). We’ll divide these methods into two parts. First, we’ll describe the methods that, ...

Get jQuery in Action, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.