OscarGodson / EpicEditor

EpicEditor is an embeddable JavaScript Markdown editor with split fullscreen editing, live previewing, automatic draft saving, offline support, and more. For developers, it offers a robust API, can be easily themed, and allows you to swap out the bundled Markdown parser with anything you throw at it.
http://epiceditor.com
MIT License
4.25k stars 338 forks source link

init editor error according by the quickstart #365

Closed wangchenOS closed 9 years ago

wangchenOS commented 9 years ago

hi,i am a newbie , now i use the lastest project js files and init an editor according by the quickstart

<head>

<script src="epiceditor/js/epiceditor.js"></script>
<script type="text/javascript">
var editor = new EpicEditor().load();
</script>
</head>
<body>
<div id="epiceditor"></div>
</body>

but chrome shows nothing and there is an error occured like this: image what is the problem?

OscarGodson commented 9 years ago

That's just JS, not specific to EpicEditor. You need to put the JS at the bottom of the </body> so all the HTML is loaded, or, if you need it in the <head> you need to wait for the DOM (HTML) to be loaded with

https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded