How to Get Value from tinymce Editor using jQuery

In this blog, we will learn how to get value from tinymce editor using jquery selector, sometimes we need to get value from tinymce editor on button click on on any event , mostly we need value on 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 let’s see how to get value :

Example:


    <textarea name="descr" id="textarea1" class="materialize-textarea">hello tinymce</textarea> 
<button type="button" id="btn">get</button>
 
<script>
            $(document).ready(function() {
    $('#btn).click( function(){
       $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 jquery ajax
Written By : Web Development Institute
Trending Courses

CodeIgniter

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing Expert Course

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

Web Expert with Python

Regular : 12 Months

Fastrack : 6 Months

Crash : 3 Months

Request For Demo