I have got the following sample, that easily detects the \"Enter\" key pressing and handles it correctly. Here it is:
The problem is solved using the following code for handling pressing the "Enter" key:
$("#search-button").on('click', function () {
var theUrl = "/search.aspx?search=" + $('#search-input').val();
window.location = theUrl;
});
$('#search-input').on('keyup', function (e) {
if (e.which == 13)
$("#search-button").trigger('click');
});
This code is built into the $(document).ready
function.