JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="MyText" value="" />
<span id="text_to_show">dsa</span>

JavaScript

jQuery(document).ready(function() {
    $('input[name="MyText"]').keypress(function(e) {
        if (e.which == 13 && !e.shiftKey) {
            $text = $(this).val();
            alert('am ajuns aici'+$text);
            $.post("path/to/handler.php", {text: $text}, function(e) {
                alert("success");
            });
        }
    });
    $('input[name="MyText"]').keyup(function(e) {
        $("#text_to_show").html($(this).val());
    });
});