//Use As Function function stopEnter() { $("form").submit(function (e) { e.preventDefault(); }); } //Use As Regular $(function () { $('form').submit(function (e) { e.preventDefault(); }); });