28 of 119 menu

The empty method

The empty method removes content from the selected elements (the elements themselves are not removed, but left empty).

Syntax

.empty();

Example

Let's remove the contents of the #test element:

<p id="test">Hello, <b>world</b>!</p> $('#test').empty();

HTML the code will look like this:

<p id="test"></p>

See also

  • method remove,
    which deletes elements without the possibility of their recovery
  • method detach,
    which removes elements with the possibility of their recovery
  • JavaScript method remove,
    which allows you to delete an element
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