Hi,
I have a ckeditor form that works perfectly fine when submitting via form action attribute, but I am trying to submit data via jQuery ajax call and I can't seem to get the value.
The first jquery .val() attempt retrieves the initial data that was populated in the textarea field regardless of whether the user changes text.
The second one (I found on the docs) retrieves undefined.
How can I get the current value of the text box?
Thanks,
-Steve
I have a ckeditor form that works perfectly fine when submitting via form action attribute, but I am trying to submit data via jQuery ajax call and I can't seem to get the value.
<form id="frmNotes"> <textarea id="textarea-notes" name="textarea-notes">#strNotes#</textarea> </form> ... snippet... var strNotes = $("#texteditor-notes").val(); var strNotes = $("#texteditor-notes.editor").val();
The first jquery .val() attempt retrieves the initial data that was populated in the textarea field regardless of whether the user changes text.
The second one (I found on the docs) retrieves undefined.
How can I get the current value of the text box?
Thanks,
-Steve
Re: using .val()
Re: using .val()
This might be related to bug #7890:
http://dev.ckeditor.com/ticket/7890
Re: using .val()
and .val() returns undefined.
I found a solution by inspecting the object in Firebug.
Seems to work fine like this, but having a .val() method on the normal object would be cleaner.
-Steve
Re: using .val()
Anyway, if you want to get the contents of an instance, use always the .getData() on it:
That will work no matter if you use no integration or if you use the jQuery adapter.