JSFiddle - React, Tailwind, and code Playground

HTML

<div id="phoneDiv">
    <span>+7 (999) 999-9999</span>
    <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").children().not('div.editmode').remove();
});