一、无法提交
在dialog中加入kindeditor时,kindeditor的位置会放置在form外,所以submit无法提交。要把kindeditor移动到form中提交才能有效。
在jquery中加入$("body > div[role=dialog").appendTo("form#form1");form1是form的id。
js:
$(function() {
$('#<u>btn</u>').click(function() {
$('#editdiv').dialog({//editdiv是要显示在dialog中div
width : 700,
open : function(event, ui) {
<span style="background-color: rgb(255, 102, 102);">$("body > div[role=dialog]").appendTo("form#form");</span>
//$("#editourTeam").parent().appendTo("#dialog_target");
// 打开Dialog后创建编辑器
KindEditor.create('textarea[name="textareaname"]', {
resizeType : 1,
afterCreate: function(){this.sync();},
//下面这行代码就是关键的所在,当失去焦点时执行 this.sync();
afterBlur: function(){this.sync();}
});
},
beforeClose : function(event, ui) {
$("form > div[role=dialog]").remove();
// 关闭Dialog前移除编辑器
KindEditor.remove('textarea[name="textareaname"]');
}
});
});
});
html:
<td><input type="button" value="编辑" class="btn" id="btn"/>
<div id="editdiv" style="display: none;" >
<table class="table" cellpadding="0" cellspacing="0">
<tr>
<td><textarea name="textareaname" style="width: 100%;height:400px;"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="确认"/></td>
</tr>
</table>
</div>
</td>
二、jquery ui dialog 中的kindeditor无法点击
$("body > div[role=dialog").appendTo("form#form1");一定要放在KindEditor.create之前!!