Javascript submit textbox on ENTER

document.getElementById("id_of_your_textbox").addEventListener("keydown", function(e) {
    if (!e) { var e = window.event; }
    e.preventDefault(); // sometimes useful

    // Enter is pressed
    if (e.keyCode == 13) { submitFunction(); }
}, false);

$('#textboxId').keydown(function (event) {
    let keyPressed = event.keyCode || event.which;
    if (keyPressed === 13) {
        $(this).closest('form').submit();
    }
});

If you don't have form, then replace $(this).closest('form').submit(); with whatever AJAX/submit logic you have.