⊗jqSeIF 78 of 113 menu

Filtering Elements in jQuery

Using the filter method, you can leave only those elements in the set that satisfy a certain selector.

Let's look at the HTML code:

<p>text</p> <p>text</p> <p class="www">text</p> <p class="www">text</p>

Let's find all paragraphs, prepend them with the text '!' using prepend, then get only the paragraphs with the class www from the found ones using the filter method and prepend them with the text '?' using append:

$('p').prepend('!').filter('.www').append('?');

Find all li in the set, then use filter to select all li with class www and append '!' to them.

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