Captured enter key on input (jQuery)

Capture enter key on input text

HTML

<button id="myInput">button</button>

JavaScript

$("#myInput").keypress(function (e) {
    if (e.which == 13) {
        alert('Captured Enter !')
        // Do whatever you need
    }
});