您的位置:首页 > Web前端 > JavaScript

JS之kindeditor的用法简介

2015-11-29 23:11 591 查看
## 解压Kindeditor的压缩包

## 前段页面(内嵌name为content的标签即可)

<p class="messageipt">
<textarea id="comment_data" name="content" class="textarea" rows="7"></textarea>
</p>


## js代码

var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name="content"]', {
newlineTag : "br",
resizeType : 2,
allowPreviewEmoticons : true,
allowImageUpload : true,
minHeight:"100px",
autoHeightMode : false,
afterCreate : function() {
this.loadPlugin('autoheight');
},
items : [
'fullscreen', 'source' , 'table',
'insertfile', 'link' , 'image' , 'emoticons' , '|' , 'forecolor', 'hilitecolor', 'bold' ,'underline', 'removeformat', '|' ,
'justifyleft', 'justifycenter', 'justifyright', 'preview']
});
});


## 获取输入框的内容
var data = editor.html();
data = encodeURIComponent(data);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: