第一个参数可用其它CSS选择器,匹配多个textarea时只在第一个元素上加载编辑器
通过K.create函数的第二个参数,可以对编辑器进行配置:
var options = {
cssPath : ‘/css/index.css‘,
filterMode : true
};
var editor = K.create(‘textarea[name="content"]‘, options);
获取HTML数据
// 取得HTML内容
html = editor.html();
// 同步数据后可以直接取得textarea的value
editor.sync();
html = document.getElementById(‘editor_id‘).value; // 原生API
html = K(‘#editor_id‘).val(); // KindEditor Node API
html = $(‘#editor_id‘).val(); // jQuery