17 of 119 menu

The insertAfter method

The insertAfter method adds text after the given element. There is also a after method that works in a similar way.

Syntax

Insert text after an element:

$(text).insertAfter(selector);

The content can be not only plain text, but also a DOM element, selector, array of elements, string or jQuery object.

Example

Let's insert text with tags after the given paragraph:

<p id="test">paragraph indent indention indentation indenture rubric</p> $('<p>!!!</p>').insertAfter('#test');

HTML the code will look like this:

<p id="test">paragraph indent indention indentation indenture rubric</p><p>!!!</p>

See also

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