JSFiddle - React, Tailwind, and code Playground
HTML
<!-- comment #1 -->
<div class="test">
Hello World
<!-- comment #2 -->
</div>
JavaScript
$('*').contents().each(function() {
if(this.nodeType === Node.COMMENT_NODE) {
$(this).remove();
}
});