Re: setHTML doesn't work in firefox on load of page

  •  09-25-2013, 8:00 PM

    Re: setHTML doesn't work in firefox on load of page

    If it helps anyone - following is the code that I have which I think is working in an ASP.NET MVC app.  This function gets called on a $(document).ready.  Notice that the code checks if the editor 'is ready'.  If not, it is calling the same method again after 10 milliseconds on a 'settimeout' - until it finds the editor is ready.

     

    var responseInitialized = false;

    function initializeEditorText() {
           var contentEditable = '<%= repsonseEditable%>';
           if (("" + contentEditable).toLowerCase() == 'true') {

               if (responseInitialized == true) {
                   return;
               }
               var editor1 = $(".myEditor");
               if (editor1 != null) {
                   if (editor1.length > 0) {
                       if (editor1[0].IsReady && editor1[0].setHTML != null) {

                           setEditorText("" + $("#responseText")[0].value);
                           responseInitialized = true;
                           sizeForm();
                           $('.myEditor').resize(function () { sizeForm(); });
                       }
                       else {
                           alert('will be trying initializeEditorText one more time in 10 milliseconds!');
                           setTimeout(function () { initializeEditorText(); }, 10);
                       }
                   }
               }
           }
       }

View Complete Thread