判断kindeditor 是否为空,如果为空不提交

        KindEditor.ready(function (K) {
            var editor = K.create('#description', {
                //上传管理
                uploadJson: '/kindeditor/asp.net/upload_json.ashx',
                //文件管理
                fileManagerJson: '/kindeditor/asp.net/file_manager_json.ashx',
                allowFileManager: true,
                //设置编辑器创建后执行的回调函数
                afterCreate: function () {
                    //alert("after");
                    $("#dailyRecordCreateSub").click(function () {
                        var conCon = $(".ke-content").html();
                        if (editor.isEmpty()) {
                            alert("is null");
                        }
                        else {
                            alert(editor.html());
                        }
                        return false;
                    })



                    var self = this;
                    K.ctrl(document, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                },
                //上传文件后执行的回调函数,获取上传图片的路径
                afterUpload: function (url) {
                    //alert(url);
                },
                //编辑器高度
                width: '786px',
                //编辑器宽度
                height: '300px;',
                //配置编辑器的工具栏
                items: [
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                'insertunorderedlist', '|', 'emoticons', 'image', 'link', 'unlink'
                ]
            });
            prettyPrint();
        });


<div class="editor-label storeDailyDesc">
                <div class="storeDailyDescLeft">描述:</div>             
                <div class="storeDailyDescRight">
                @Html.TextAreaFor(model => model.description)      
                @Html.ValidationMessageFor(model => model.description)
                </div>
            </div>

猜你喜欢

转载自blog.csdn.net/gditzmr/article/details/40111907