Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
25 of 119 menu

The replaceAll method

The replaceAll method replaces some elements with others. It works similarly to the replaceWith method.

Syntax

The method parameter can be text (possibly with tags), an array, a DOM element, or a jQuery object:

$(elements).replaceWith(elements);

Example

Let's replace all paragraphs with class www with a div with text '!!!':

<p class="www">text</p> <p class="www">text</p> <p class="www">text</p> <p>text</p> $('<div>!!!</div>').replaceAll('p.www');

HTML the code will look like this:

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

See also

  • method replaceWith,
    which also replaces some elements with others
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