CKEditor InnerHTML error

I have two CKeditor fields that are a part of the form. I have some action buttons on the page, so whenever I click either 'clear' or 'cancel' this function is fired along with other stuff:

CKEDITOR.instances['ed1'].updateElement(); CKEDITOR.instances['ed1'].setData(''); CKEDITOR.instances['ed2'].updateElement(); CKEDITOR.instances['ed2'].setData('');

That way I am cleaning the contents of the CKEditor fields. The problem is that if I click 'cancel', then go back to the page and click "clear", Internet Explorer gives an "innerHTML is null or undefined" JS error.

It works fine in other browsers and only happens if I perform the update twice in a row from different buttons. Is there a workaround for that?

CKEditor initialization onReady:

CKEDITOR.replace('ed1', { htmlEncodeOutput: true, width:"700",toolbar: 'Basic' }); CKEDITOR.replace('ed2', { htmlEncodeOutput: true, width:"700",toolbar: 'Basic' });

I probably should add that I use .show() and .hide() whenever I use cancel button to hide the form and show other stuff. There's no page reload.


I found the solution to this problem. The reason it was doing that because my clear method was fired using jQuery bind function and wasn't placed in the onReady function, so it was binding the events together and giving this error. The solution to this was to use unbind first.

Category:javascript Time:2011-10-28 Views:1

Related post

  • innerhtml errors with IE 10 2013-08-04

    Some of our Windows 7 machines were updated with IE 10, and we now find that many web pages on our intranet do not load properly. Most of the errors are regarding "innerHTML". These pages load and render fine with IE 9, and they load and render fine

  • Error messages show up in the pop-up window, how to fix? 2009-08-25

    I have this signature generator script. And when the images you upload does not meet the requirements the user recieves an error message. The problem here is that the error message shows up in the uploading pop-up, is there any way to show the error

  • How to not display error element as label with jquery.validation plugin 2010-03-03

    Okay guys, I have read through all the other posts and question on jQuery Validation plugin and they don't seem to have what I'm looking to do. I would like to have the display error not show with message but just create a red border around the input

  • php custom forum error 2010-03-12

    i have a form, and i want to have it be limited at 10 characters minimum. that is no problem, but what i want to do is echo the error at the top of the page, which is being included, so i cant just do: echo '<div class="error">Error</div>

  • Adding CKEditor through javascript onclick event adds a CKEditor to the DOM but does not allow me to enter text into it. Why? 2010-05-07

    I'm adding a ckeditor to my form using the onclick functionality - i.e., when the user clicks a button, the ckeditor is added to the form. I'm echoing out the html generated when a ckeditor is added to a page through the javascript function. The cked

  • Error messages in ASP.NET with jQuery UI 2010-06-08

    I've been using my own Error reporting module which was combination of simple c# and jQueryUI Dialog. Problem is that once error or success occurs i do write it's value to session. It does work pretty good on pages with Responce.Redirect on error but

  • JavaScript Live Error Display? 2010-11-09

    I need an efficient way to display errors I've collected from a form onsubmit function. Here is my error collecting function: function checkForm(form) { var errors = ""; errors += checkName(form,; errors += checkSex(form,

  • Why would I be getting a "missing ) after argument list" error? 2011-06-19

    I am working on an AJAX system to submit a form, but I can't even get my JavaScript to load, the Firebug report is below. missing ) after argument list else if( httpRequest.responseText == 'already logged in' )\n I poked around the internet and SO, b

  • IE not displaying strings with HTML tags passed to innerHTML 2011-06-19

    I am passing a string containing HTML tags (center, ul, etc) to a function which then places it in a div, span or p innerHTML. This works great in all browsers but IE, which displays nothing. I tracked the problem the the tags, because plain text doe

  • Javascript form validation, showing error message next to 2011-10-26

    I'm new to Javascript and HTML and am trying to do some form validation. When the validation() fails for some input like <input type="text" name="firstName" /> I'd like to have an error message show next to the field that was in error. How do I

  • HTML5 Server-Sent Events prototyping - ambiguous error and repeated polling? 2012-01-30

    I'm trying to get to grips with Server-Side Events as they fit my requirements perfectly and seem like they should be simple to implement, however I can't get past a vague error and what looks like the connection repeatedly being closed and re-opened

  • javascript load content into div error:0 2012-02-02

    I am using javascript to pull data from a URL and put it into a div: function ahah(url, target) { document.getElementById(target).innerHTML = 'Fetching fixtures...'; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXOb

  • Hide JS error without custom error handler 2012-03-13

    I have one line of code that is throwing an error that I don't care about. I need to hide it from the console. I don't want to use a custom error handler and return false, because I want to see all other errors. I've tried a try / catch, but the erro

  • "Origin null is not allowed by Access-Control-Allow-Origin." Error when calling a web service with jQuery 2012-03-31

    I have created a web service which returns some data and am trying to access it using jquery but the console displays the following errors: OPTIONS http://localhost:56018/PhoneWebServices.asmx?op=GetMyChildren 405 (Method Not Allowed) jQuery.ajaxTran

  • How to upload to Database SQL Server? where is the possible coding error? 2014-08-05

    string fname=""; <----- Global variable HtmlInputFile file = (HtmlInputFile)place.FindControl("f_upload"); if (filename.Value.Equals("")) { span1.InnerHtml = "<b>Error Message : A File Name must be enter </b>"; return; } if (file.Poste

  • ASP.NET WebService Returns Gibberish Characters When Throwing Exceptions 2008-09-15

    Greetings! I have a web service (ASMX) and in it, a web method that does some work and throws an exception if the input wasn't valid. [ScriptMethod] [WebMethod] public string MyWebMethod(string input) { string l_returnVal; if (!ValidInput(input)) { s

  • Reading file contents on the client-side in javascript in various browsers 2009-04-15

    I'm attempting to provide a script-only solution for reading the contents of a file on a client machine through a browser. I have a solution that works with Firefox and Internet Explorer. It's not pretty, but I'm only trying things at the moment: fun

  • Form gets submitted even if JavaScript fun returns false 2009-09-13

    Pls check code .html form gets submitted even if javascript returns false. <form id="form1" name="form1" method="post" action="sub.jsp" onsubmit="return getValue()"> <input type="text" id="userName" name="userName" onkeyup="return getValue()

  • Will AJAX methods calls complete when an exception is thrown? 2009-10-12

    When a menu item is clicked in my menu an ASCX control is loaded via AJAX in my asp panel. To do this I have a method: public void LoadControl(ControlDestination controlDestination, string filename) { try { // Load control from file Control control =

Copyright (C), All Rights Reserved.

processed in 0.692 (s). 13 q(s)