Fetching the HTML Text Content of an TinyMCE Editor in Iframe using JQuery

Fetching the html / Text content of an tinymce editor in iframe using JQuery

Today I confronted a situation when I needed to get the value of a specific control like “tinyMCE”. Initially I struggled to fetch value however later succeeded to get value.

and this is how I get the value and made it easy for further execution.

This is how TinyMCE looks like in MVC as depicted below on a MVC page. 

The declaration of tinyMce on .cshtml page is defined as :

  1. @Html.EditorFor(“textTiny”, “tinymce_full_compressed”);  

 

There are two ways to get the desired information:

  1. $('#txtTest_ifr').contents().find('#tinymce').html();  

  1. $('#txtTest_ifr').contents().find('#tinymce').Text();  

 

However this is very concise in manner but will be fruitful in use.

Thanks