我在我的应用程序中使用CKeditor-4,在我的编码中,我想通过它的id获取元素。下面的代码返回FF和IE中的元素,但它在Google 中返回null。
var ele = EditorInstance.document.getById("id_1");在谷歌Chrome中,任何替代程序都可以通过其id获取元素。
提前感谢
发布于 2013-01-08 14:59:50
如果您使用的是本机方法,请检查一下:
EditorInstance.document.$.getElementById( 'id_1' );如果这个也是null,请确保您的id是正确的。ids区分大小写,所以iD_1 != id_1。
document.getById实现非常简单:
getById: function( elementId ) {
var $ = this.$.getElementById( elementId );
return $ ? new CKEDITOR.dom.element( $ ) : null;
},这里有很小的机会,有些东西真的坏了。
发布于 2013-01-10 06:40:18
以前我用过
content = EditorInstance.getData();
EditorInstance.setData(content);" 由于这个原因,它没有在铬中工作。
但现在我用
content = rootElement.getHtml();
rootElement.setHtml(content);而且它运转良好..。
https://stackoverflow.com/questions/14215410
复制相似问题