Wednesday, July 8, 2015

Fetching the html content of an 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.

image

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

 

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

image

There are two ways to get the desired information:

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

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

 

image

 

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

 

Thanks

0 comments :

Post a Comment