How to Get tinymce Editor Value Using Javascript

In this blog, we will learn how to get value from tinymce editor using javascript, sometimes we need to get value from tinymce editor on a button click on on any event, mostly we need a value on the event when we use ajax in our project.

To get value from tinymce editor is not easy as compared to other inputs but also it is not much difficult to let’s see how to get value :

Example:


    <textarea name="descr" id="textarea1" class="materialize-textarea">hello tinymce</textarea> 
<button type="button" onclick="getcontent()">get</button>
<script>
            function getcontent()
{
var data;
       data=tinyMCE.get("#textarea1").getContent();
console.log(data);
}
</script>
 

Note:

In the above example we have used tinyMce.get().getContent() function, so to use this function you should place this code after the tinmyce.js file otherwise this code would not work.

Categories: web designing web development javascript ajax

Trending Courses

CodeIgniter

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing

Regular : 6 Months

Fastrack : 3 Months

Crash : 2 Months

React JS

Regular : 45 Days

Fastrack : 25 Days

Crash : 15 Days

Laravel

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Front End Developer

Regular : 6 Months

Fastrack : 4 Months

Crash : 2 Months

Request For Demo