We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Auto-save contents of ejRTE


Is it possible to save the contents of an ejRTE control automatically when the control loses focus?  Alternately, would it be possible to save the contents of the control periodically, say every 15 seconds? 

The blur event would be the obvious choice but the ejRET doesn't expose a blur event.

The change event would be the other obvious choice here but I believe that event will fire too often;  unless the changes could be cached and submitted when the user leaves the page.

Would it be possible to catch an event triggered when the user leaves the page, and if the control has unsaved changes, save them at that point?  For example, the change event could set a flag indicating that there are unsaved changes, and the "save" button would set that flag to false.

Thank you,


3 Replies

MM Manikandan Mariappan Syncfusion Team April 13, 2015 01:21 AM

Hi Randy,
Thanks for using Syncfusion products.
Query: Is it possible to save the contents of an ejRTE control automatically when the control loses focus?
We have analyzed your requirement and we can achieve it by binding the click event to the iframe element. Also we need to bind document click event for capture the iframe focus out. Since focusout and blur events cannot be cached within the iframe, when we click the document we can get the html string from the RTE instance to save it. Please refer the below code.


var rteObj, isFocus, data;

$(function () {


width: "850px",

showFooter: true,


rteObj = $("#rteSample").data("ejRTE");

$("#" + rteObj.element[0].id + "_Iframe").contents().on("click", function () {

//get html string in iframe textarea using getHtml() method

if (!isFocus) data = rteObj.getHtml();

//maintain flag variable for element focused or not.

isFocus = true;


//when click the document or any other popup element append in body the document click will triggered

$(document).click(function (e) {

//validate the iframe is focused in previously or not, then made any changes in html string

if (isFocus) {

alert("content saved");

isFocus = false;




For your convenience, we have prepared a simple sample based on your requirement. You can also download the attached sample from the following location.
Sample: Sample

Please let us know if you have any queries.

RC Randy Craven April 13, 2015 08:09 AM


Thank you for this answer.


MM Manikandan Mariappan Syncfusion Team April 14, 2015 11:23 PM

Hi Randy,

Thanks for the update

Please get back to us if you would require any further assistance.


Live Chat Icon For mobile
Up arrow icon