retrieving value of CKEditor instance with javascript (jquery)
I have a page with a form to create a group email campaign, and the client would now like the option to preview the email before it is sent.
Using jquery, I am passing the values of my form fields into an ajax request and setting a couple of session variables, which I then use in my email preview.
The subject field in the form is just a text field and I am setting the subject session variable like so...
$.ajax({
type: 'POST',
url: 'setmailsession.php',
data: { subject: $('#emailsubject').val() }
})
which seems straightforward, as the subject text field has an id of ‘emailsubject’
However, I cannot retrieve the content of the text message from ckeditor.
The text editor doesn’t seem to have an id, but is named editorField, and there is only one instance of it, so I tried (amongst other things) document.getElementsByName('editorField').item(0).value, but no value is returned.
Grateful if anyone can tell me, how do I retrieve the value of the text editor field with js ?