JSFiddle - React, Tailwind, and code Playground

HTML

<div contentEditable="true">
    "abcd"
    <div>efgh</div>
    <div>ijkl</div>
</div>

JavaScript

$(function(){
    $('div[contentEditable="true"]').each(function(){
        var text = $(this).clone().children().remove().end().text();
       var $children = $(this).children();
        
        $(this).empty().append('<div style="color:red;">'+text+'</div>').append($children);
        });
});