$(document).ready(function () { $('#email').focus(); debugger; //template $('#btnSubmit').click(function (e) { e.preventDefault(); path = $(this).data('path'); $("#btnSubmit").prop("disabled", true) $('#btnSubmit').html(" Submitting..."); email = $("#email").val(); $.ajax({ type: "POST", url: "/tenant/forgot-password-submit", data: JSON.stringify({ email: email, }), contentType: "application/json;charset=utf-8", dataType: "json", success: function (result) { $("#btnSubmit").prop("disabled", false) $('#btnSubmit').html("Submit"); if (result.Error) { $("#message").html("
" + result.Message + "
"); //logError(result.Message); //todo } else { $("#message").html("
" + result.Message + "
"); } } }); return false; }); $('input').keypress(function (e) { if (e.which == 13) { $("#btnSubmit").click(); return false; //<---- Add this line } }); });