jquery clear all content of a div code example
Example: jquery clear text in div
// removes only text, no changes to children
$('#YourDivId').contents().filter((_, el) => el.nodeType === 3).remove();
// removes only text, no changes to children
$('#YourDivId').contents().filter((_, el) => el.nodeType === 3).remove();