55 of 119 menu

The find method

The find method searches for elements within elements already found.

Syntax

Search by selector:

.find(selector);

You can search not only by selector, but also by DOM element or jQuery object:

.find(jQuery object or DOM element);

Example

Let's find all div tags, prepend them with '!' using prepend, then find all paragraphs inside them using find and prepend them with '?':

<div> <p>text</p> <p>text</p> <p>text</p> </div> <div> <p>text</p> <p>text</p> <p>text</p> </div> $('div').prepend('!').find('p').append('?');

HTML the code will look like this:

<div> ! <p>text?</p> <p>text?</p> <p>text?</p> </div> <div> ! <p>text?</p> <p>text?</p> <p>text?</p> </div>

See also

  • method filter,
    which filters the elements in a set
  • method has,
    which filters the set of selected elements by descendants
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline