Skip to the content.

$.fn.empty()

Remove every child node from each element in the collection. Leaves the elements themselves in place.

Signatures

empty(): this;

Parameters

None.

Returns

The original Dabby collection for chaining.

Examples

import $ from "dabbyjs";
import "dabbyjs/manipulation/empty/empty";

// Clear a list before re-rendering
$("#results").empty();
import $ from "dabbyjs";
import "dabbyjs/manipulation/empty/empty";

// Empty multiple containers in one go
$(".panel").empty().append("<p>No data.</p>");

See also