Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
⊗jqDmERRw 60 of 113 menu
◀ ▶

Replacing Elements with jQuery's replaceWith Method

You can replace one element with another using the replaceWith method.

Let's look at an example, let's say we have the following paragraphs:

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

Let's replace all paragraphs with class www with '<div>!!!</div>':

$('.www').replaceWith('<div>!!!</div>');

HTML the code will look like this:

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

Replace each h2 with its contents.

Replace each h2 with its contents, after wrapping the contents in a paragraph.

← →
↑
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