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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Auto-save contents of ejRTE

Thread ID:





118788 Apr 9,2015 07:14 PM UTC Apr 15,2015 04:23 AM UTC JavaScript 3
Tags: ejRTE
Randy Craven
Asked On April 9, 2015 07:14 PM UTC


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,


Manikandan Mariappan [Syncfusion]
Replied On April 13, 2015 06:21 AM UTC

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.

Randy Craven
Replied On April 13, 2015 01:09 PM UTC


Thank you for this answer.


Manikandan Mariappan [Syncfusion]
Replied On April 15, 2015 04:23 AM UTC

Hi Randy,

Thanks for the update

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



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon