首页 > 代码库 > 代码控制 textarea 控件是否为KindEditor 编辑框
代码控制 textarea 控件是否为KindEditor 编辑框
<script charset="utf-8" src="http://www.mamicode.com/<%:Url.Content("~/UI/Scripts/KindEditor/kindeditor.js") %>"></script>
<script charset="utf-8" src="http://www.mamicode.com/<%:Url.Content("~/UI/Scripts/KindEditor/lang/zh_CN.js") %>"></script>
<script charset="utf-8" src="http://www.mamicode.com/<%:Url.Content("~/UI/Scripts/KindEditor/prettify.js") %>"></script>
<script>
function LoadEditor(TextName) {
var editor = KindEditor.create(‘textarea[name="‘ + TextName + ‘"]‘, {
uploadJson: "/fileManagerJson/Index",
fileManagerJson: ‘/fileManagerJson/DistanceIndex‘,
allowFileManager: false,
resizeType: 1,
items: [‘undo‘, ‘redo‘, ‘|‘, ‘cut‘, ‘copy‘, ‘paste‘, ‘|‘, ‘selectall‘, ‘forecolor‘, ‘bold‘, ‘image‘, ‘multiimage‘],
autoHeightMode: true,
afterCreate: function () {
this.loadPlugin(‘autoheight‘);
},
afterChange: function () {
this.sync();
},
afterBlur: function () {
this.sync();
}
});
return editor;
}
$(function () {
$("#aRefused").click(function () { //为激发事件
$.ajax({
type: "POST",
url: "/Shared/OrderBackPop",
success: function (data) {
$("body").eq(0).append(data);//data返回的是html代码
var arrEditor = $("textarea[name=‘resonContent‘]");
$.each(arrEditor, function () {
// 加载编辑器
LoadEditor($(this).attr(‘name‘));
});
}
});
});
});
</script>
代码控制 textarea 控件是否为KindEditor 编辑框