xheditor!渲染 JS 动态生成的textarea!

默认设置时非标准submit提交时无法同步编辑内容,需要指定提交按钮的ID值,以触发编辑值同步

Class类初始化

 class="xheditor {submitID:'save'}"

Javascript初始化

$('#elem1').xheditor({submitID:'save'});

方法1:在textarea上添加属性: class="xheditor"
 例如:<textarea name="content" class="xheditor">test</textarea>

方法2:在您的页面初始JS代码里加上: $('#elm1').xheditor();
$('#elm1').xheditor();
例如:
$({
$('#elm1').xheditor();
});
相应的卸载编辑器的代码为
$('#elm1').xheditor(false);

重要说明:2种初始化方法只能选择其中一种,不能混合使用,优先级分别是:class初始化>JS初始化,如果页面中使用了class初始化模式,JS初始化代码就无效了


原文地址:https://www.cnblogs.com/yangzhi/p/3576617.html