'checkValidity' called on an object that does not implement interface HTMLButtonElement.

错误内容:
Uncaught TypeError: 'checkValidity' called on an object that does not implement interface HTMLButtonElement.

js代码:

<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer;

        // 添加学生操作
        form.on('submit(submit)', function (data) {
            $.post("stu/insert",{data},function (resquest){
                if (resquest.code == 200){
                    layer.msg("添加成功!")
                }else {
                    layer.msg("添加失败!")
                }
                return false;
            })
            })
        })
</script>

没看出什么问题,你可以用注释法。一段代码一段代码注释。看看哪里引起的

问题已解决:

<script>

    layui.use(['form'], function () {

        var form = layui.form,

            layer = layui.layer;

 

        // 添加学生操作

        form.on('submit(submit)', function (data) {

            data = data.field;          //需要添加这一段代码

            $.post("stu/insert",{data},function (resquest){

                if (resquest.code == 200){

                    layer.msg("添加成功!")

                }else {

                    layer.msg("添加失败!")

                }

                return false;

            })

            })

        })

</script>