<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 :
TypeError: Cannot call method
'getEditor'
of undefined
var objEditor = CKEDITOR. instances["sectionTextArea"]; var q = objEditor. getData(); This will get me the text entered in CKEditor, without any markup.
you can add the following code : the ckeditor field data will be stored in $('#ELEMENT_ID'). val() via each click. I've used the method and it works very well. ckeditor field data will be saved realtime and will be ready for sending.
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.
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:
<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?).
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
try adding it separately,here is the link
http://docs.ckeditor.com/source/ckeditor.html#CKEDITOR
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
I had a similar problem and sorted it by doing the following;
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<script>
if($("textarea").length > 0){
CKEDITOR.replace( 'ckeditor' );
}
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With