JSFiddle - React, Tailwind, and code Playground

HTML

<div id="phoneDiv">+7 (999) 999-9999
    <div class="editmode">
        <input type="text" placeholder="Телефон" value="+7 (999) 999-9999" id="editPhone" name="editPhone" class="text key">
    </div>
</div>

JavaScript

$(document).on('click','#phoneDiv',function(){
        $("#phoneDiv").contents().filter(function() {
            return (!$(this).is(".editmode"));
        }).remove();
    });