div clear in jquery code example
Example 1: jquery clear text in div
// removes only text, no changes to children
$('#YourDivId').contents().filter((_, el) => el.nodeType === 3).remove();
Example 2: clear a div
$("#yourDiv").html(""); // jQuery
// removes only text, no changes to children
$('#YourDivId').contents().filter((_, el) => el.nodeType === 3).remove();
$("#yourDiv").html(""); // jQuery