当我多次单击Enter时,则多次创建Record

时间:2018-02-13 06:46:04

标签: javascript jquery

当我多次点击Entyer时,记录多次创建

    $(document).keydown(function (e) {
        debugger;
        // Create receipt on press key enter
        if (e.keyCode == 13) {
            $("input[id='BtnCreate'").focus().click();
            return false;

        }
        // Go back the previous page on press esc key
        if (e.keyCode == 27) {
            var url = $("#btnCancel").attr("href");
            window.location = url;
            return false;
        }

    });
},

1 个答案:

答案 0 :(得分:0)

    $(document).keydown(function (e) {
        debugger;
        // Create receipt on press key enter
        if (e.keyCode == 13) {
            $("input[id='BtnCreate'").focus().click();
            $('#BtnCreate').off();
            return false;
        }
        // Go back the previous page on press esc key
        if (e.keyCode == 27) {
            var url = $("#btnCancel").attr("href");
            window.location = url;
            return false;
        }

    });
},