KindEditor编辑器 的应用

导入KindEditor编辑器的js文件

<script type="text/javascript" src="/resource/kindeditor/kindeditor-all.js"></script>
<body>
<textarea name="pt_content" id="pt_content" style="height:200px;"></textarea>
</body>

js 文件

var editor;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[name="pt_content"]', {
			resizeType : 1,
			allowPreviewEmoticons : false,
			allowImageUpload : false,
			width:'550px',
			items : [
				'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', '|', 'emoticons', 'image', 'link'],
			afterBlur: function(){this.sync();}
		});
	});
  • 注意:赋值得用下面的方式赋值
    KindEditor.html("#pt_content","赋值的文字");//给KindEditor赋值

效果展示

在这里插入图片描述

  • 注意 : 我用的是简单版的输入框

勿喷
欢迎给更多意见
qq: 2692289866 说明来意

猜你喜欢

转载自blog.csdn.net/weixin_43458790/article/details/85196415