[textarea禁止拉伸]解决textarea得不到KindEditor编辑器值的方法

更新时间:2020-03-11    来源:jquery    手机版     字体:

【www.bbyears.com--jquery】

首先描述下我这边KindEditor的错误现象:
1、在IE8/FF下均得不到值;
2、当点击KindEditor的全拼按钮切换到全屏模式输入时,再返回正常模式,可以得到值;
3、我用的是jQuery的点击事件提交表单的,提交,无法得到值;
4、直接用表单的提交按钮可以得到值。

开始使用方法:

KindEditor.create("textarea[id="fieldContent1"]",{
items : ["source", "|", "fullscreen", "undo", "redo", "cut", "copy", "paste", "|",
        "fontname", "fontsize", "forecolor", "hilitecolor", "bold", "italic", "underline",
        "removeformat", "justifyleft", "justifycenter", "justifyright", "insertorderedlist",
        "insertunorderedlist", "|", "emoticons", "image", "link", "|", "about"]
});

结果提交表单的时候textarea没有获取到KindEditor文本编辑器的值

解决办法如下:

KindEditor.create("textarea[id="fieldContent1"]",{
items : ["source", "|", "fullscreen", "undo", "redo", "cut", "copy", "paste", "|",
        "fontname", "fontsize", "forecolor", "hilitecolor", "bold", "italic", "underline",
        "removeformat", "justifyleft", "justifycenter", "justifyright", "insertorderedlist",
        "insertunorderedlist", "|", "emoticons", "image", "link", "|", "about"],
        syncType:"form",
        afterCreate : function() {
            var self = this;
            self.sync();
        },
        afterChange : function() {
            var self = this;
            self.sync();
        },
        afterBlur : function() {
            var self = this;
            self.sync();
        }
});

官方解释:
sync()
将编辑器的内容设置到原来的textarea控件里。
参数: 无
返回: KEditor

本文来源:http://www.bbyears.com/wangyezhizuo/86428.html

热门标签

更多>>

本类排行