<textarea cols="50" id="txt" contenteditable="true" name="editor1" runat="server" rows="10"></textarea>
<script type="text/javascript" src="css-js/ckeditor.js"></script>
<script type="text/javascript">
CKEDITOR.replace('txt', {
});
</script>
I get this err on js :
我在js上得到这个错误:
TypeError: Cannot call method
'getEditor'
of undefinedTypeError:无法调用未定义的方法'getEditor'
3 个解决方案
#1
15
First of all, contenteditable="true"
tag is totally invalid and obsolete in your case. Such attribute is relevant for inline instances only and, as <textarea>
is not (content)editable, you don't need it.
首先,contenteditable =“true”标签在您的情况下完全无效且过时。此类属性仅与内联实例相关,并且由于
Anyway, (even if buggy) your code works for me like a charm (fiddle). As a word of explanation, the error you see is produced when there's no element of an id
passed to CKEDITOR.replace()
, i.e:
无论如何,(即使有错误)你的代码对我来说就像一个魅力(小提琴)。作为解释,当没有传递给CKEDITOR.replace()的id的元素时,会看到您看到的错误,即:
<textarea id="foo"></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'bar' ); // <textarea> is #foo, error will be thrown
</script>
Make sure your DOM is valid and <textarea>
exist when CKEDITOR.replace
is called (working async?).
当调用CKEDITOR.replace(工作异步?)时,确保你的DOM有效并且
#2
3
Use
使用
CKEDITOR.appendTo( 'txt' ); for DOM elements
CKEDITOR.replace( 'textarea' ); for textarea
Ok dude try this also
好的家伙也试试这个
the functions appendTo and replace are all located in themedui.js file
函数appendTo和replace都位于themedui.js文件中
try adding it separately,here is the link
尝试单独添加,这是链接
http://docs.ckeditor.com/source/ckeditor.html#CKEDITOR
http://docs.ckeditor.com/source/ckeditor.html#CKEDITOR
#3
0
if you just want to get rid of that, use
如果你只是想摆脱它,请使用
try{CKEDITOR.replace('body')}catch{}
it will cause CKEDITOR to open where you want it to
它会使CKEDITOR在你想要的地方打开
#1
15
First of all, contenteditable="true"
tag is totally invalid and obsolete in your case. Such attribute is relevant for inline instances only and, as <textarea>
is not (content)editable, you don't need it.
首先,contenteditable =“true”标签在您的情况下完全无效且过时。此类属性仅与内联实例相关,并且由于
Anyway, (even if buggy) your code works for me like a charm (fiddle). As a word of explanation, the error you see is produced when there's no element of an id
passed to CKEDITOR.replace()
, i.e:
无论如何,(即使有错误)你的代码对我来说就像一个魅力(小提琴)。作为解释,当没有传递给CKEDITOR.replace()的id的元素时,会看到您看到的错误,即:
<textarea id="foo"></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'bar' ); // <textarea> is #foo, error will be thrown
</script>
Make sure your DOM is valid and <textarea>
exist when CKEDITOR.replace
is called (working async?).
当调用CKEDITOR.replace(工作异步?)时,确保你的DOM有效并且
#2
3
Use
使用
CKEDITOR.appendTo( 'txt' ); for DOM elements
CKEDITOR.replace( 'textarea' ); for textarea
Ok dude try this also
好的家伙也试试这个
the functions appendTo and replace are all located in themedui.js file
函数appendTo和replace都位于themedui.js文件中
try adding it separately,here is the link
尝试单独添加,这是链接
http://docs.ckeditor.com/source/ckeditor.html#CKEDITOR
http://docs.ckeditor.com/source/ckeditor.html#CKEDITOR
#3
0
if you just want to get rid of that, use
如果你只是想摆脱它,请使用
try{CKEDITOR.replace('body')}catch{}
it will cause CKEDITOR to open where you want it to
它会使CKEDITOR在你想要的地方打开