<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Batch Editor Examples</title>
<style>
form {
margin: 0;
}
textarea {
display: block;
}
</style>
<link rel="stylesheet" href="../themes/default/default.css" />
<script charset="utf-8" src="jquery.js"></script>
<script charset="utf-8" src="../kindeditor-min.js"></script>
<script>
function LoadEditor(TextName) {
var editor = KindEditor.create('textarea[name="' + TextName + '"]', {
allowFileManager: true,
autoHeightMode: true,
afterCreate: function() {
this.loadPlugin('autoheight');
},
afterChange: function() {
this.sync();
},
afterBlur: function() {
this.sync();
}
});
return editor;
}
function AddLoadEditor() {
var strHtml;
strHtml = '<div style="padding-bottom:10px;"><textarea name="Content" data-name="textarea" style="width:98%;height:350px;"></textarea></div>';
$('#myform').append(strHtml);
var arrEditor = $("textarea[data-name='textarea']");
$.each(arrEditor, function() {
// 加载编辑器
LoadEditor($(this).attr('name'));
});
}
</script>
</head>
<body>
<h3>Batch Editor Examples</h3>
<input type="button" onClick="AddLoadEditor()" value="添加编辑器" />
<form id="myform">
</form>
</body>
</html>