JSFiddle - React, Tailwind, and code Playground

HTML

<div id="div_cargo" style="font-size:16px">
    <label id="cargo">Prueba</label>
</div>

JavaScript

$('#cargo').on("dblclick", function(){
        $("#cargo").hide();
        $("#div_cargo").append('<input id="new_cargo" type="text"  value="'+$('#cargo').html()+'" >');        
        $("#new_cargo").keydown(function(e){
           var key = e.keyCode || e.which;
           if(key == 13 || key == 9){   
               alert("Enter");    
               $("#cargo").html($("#new_cargo").val());
               $("#cargo").show();
               $("#new_cargo").empty().remove();
           }
        });       
    });