Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 1. jQuery Basics > Finding Descendant Elements Within the Currently Sel...

1.7. Finding Descendant Elements Within the Currently Selected Wrapper Set

1.7.1. Problem

You have a set of selected DOM elements (or a single element) and want to find descendant (children) elements within the context of the currently selected elements.

1.7.2. Solution

Use the .find() method to create a new wrapper set of elements based on the context of the current set and their descendants. For example, say that you have a web page that contains several paragraphs. Encapsulated inside of these paragraphs are words that are emphasized (italic). If you’d like to select only <em> elements contained within <p> elements, you could do so like this:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial