jQuery пусто
// Remove all child nodes of the set of matched elements from the DOM
// This method does not accept any arguments.
$("div.parent").empty();
Sparkling Squirrel
// Remove all child nodes of the set of matched elements from the DOM
// This method does not accept any arguments.
$("div.parent").empty();
// Remove all child nodes of the set of matched elements from the DOM
// This method does not accept any arguments.
$("div.parent").empty();
$("button").click(function(){
$("div").empty();
});
// removes only text, no changes to children
$('#YourDivId').contents().filter((_, el) => el.nodeType === 3).remove();
empty: function() {
var elem,
i = 0;
for ( ; ( elem = this[ i ] ) != null; i++ ) {
if ( elem.nodeType === 1 ) {
// Prevent memory leaks
jQuery.cleanData( getAll( elem, false ) );
// Remove any remaining nodes
elem.textContent = "";
}
}
return this;
}