How to get CKEditor Textarea Value using jQuery

Dear Reader, let us we know that “How to get CKEditor Textarea Value using jQuery“.  In one of the project’s mailing scenario, there was a need to add the CKEditor Textarea to add mail body content. It was easy to add the editor to the page, but it was a little bit struggling to get contents from CKEditor using jQuery.

Start Step Wise:-
Step 1.

Added CKEditor using this Code:-

 

It will look like this image attached and we need to get TextArea Contents.

CKEditor Textarea Value

In General, we would use the following code for getting contents on submitting of form. But that does not work when using CKEditor Text Area for the input of contents.

The above code works as long as it is a textarea. Once you add the CKEditor class to the textarea the textarea is replaced with a rich text editor and above code will not get the value.

Step 2.

Now to get the contents on submitting a form, you have to use the following code:-

It will give the Result like:-

So again you need to remove <div> tag and get exact actual placed contents.

Step 3.

Hence need to follow this code too.

Now you will get the Mail body content i.e CKEditor Textarea Value as it is, which is without any <div> tag and without any left, right extra space.

And if you want to get CKEditor TextArea Value as it is (with proper formattings, like with bold, italic styles).Like below image attached:-

CKEditor TextArea Contents

Step 4.

And want to send this in AJAX data parameter. Then you need to add the code below:-

As Data will be posted in this format.

Step 5.

POST Parameters:-

POST Source:-

Finally, you can check your mail contents with proper formatting. If you find this article useful for you, then please share it on social networking sites or comment us. And if you have any queries, then also please ask using comments below or Contact Us at this linkThanks for being with us.

 

 

«
»

2 Comments:

  • nike basketball shoes April 25, 2018

    Thank you so much for providing individuals with remarkably splendid opportunity to check tips from this website. It is often so useful and also jam-packed with a great time for me and my office acquaintances to visit your website particularly 3 times weekly to read through the newest guidance you have. Of course, I’m just actually contented for the exceptional strategies you give. Selected 1 points on this page are particularly the most impressive I’ve had.

    Reply

    • Webpreparations Team April 25, 2018

      Thanks a ton, Dear Reader 🙂

      Reply

Leave a comment:

Your email address will not be published. Required fields are marked *