Uncaught TypeError: Cannot read property 'document' of null

2,476 views
Skip to first unread message

dsd

unread,
Nov 12, 2010, 1:22:29 AM11/12/10
to cleditor
Strange... I get this error using Chrome (not IE) each time a load the
page but if I reload the page it goes away??

Using:

<link rel="stylesheet" type="text/css" href="../cle_editor/
jquery.cleditor.css" />
<script type="text/javascript" src="../scripts/jquery-1.4.3.min.js"></
script>
<script type="text/javascript" src="../cle_editor/
jquery.cleditor.min.js"></script>
<script type="text/javascript" src="../scripts/jquery-
ui-1.8.6.custom.min.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
$(document).ready(function() {
$("textarea").cleditor({
width:600, // width not including margins, borders or padding
height: 150, // height not including margins, borders or padding
controls: // controls to add to the toolbar
"bold italic " +
"| bullets | outdent indent " +
"| undo redo | " +
"link unlink | cut copy paste pastetext | source",
useCSS: false, // use CSS to style HTML when possible (not supported
in ie)
docType:// Document type contained within the editor
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">',
docCSSFile: // CSS file used to style the document contained within
the editor
"",
bodyStyle:// style to assign to document body contained within the
editor
"margin:4px; font:10pt Arial,Verdana; cursor:text"
});
});

-->
</script>

And I have multiple textareas on within the form.

Error:

// Load the iframe document content
var contentWindow = $frame[0].contentWindow,
doc = editor.doc = contentWindow.document,

Uncaught TypeError: Cannot read property 'document' of null

$doc = $(doc);


Any help would be most appreciated.

Thank you.

Chris Landowski

unread,
Nov 12, 2010, 9:10:27 AM11/12/10
to cled...@googlegroups.com
Hello dsd,

Since this problem does not occur in the online demo, it must be something
unique to your code. To isolate the cause, I would start out by removing the
useCSS, docType, docCSSFile and bodyStyle optional parameters and see if the
problem still occurs. It appears that you are simply supplying the default
values, so that code isn't really needed.

Hope this helps,
Chris

Reply all
Reply to author
Forward
Message has been deleted
0 new messages