I'm trying to set up SimpleMDE for an Open Source web application (PHP) and got the following error in Firefox developer console:
SimpleMDE: Error. No element was found.
I tried this in an independent HTML page and couldn't make it work either. Here is the source code:
<html>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
<script>
new SimpleMDE({
element: document.getElementById("demo1"),
spellChecker: false,
});
</script>
<form>
<textarea name="desc" id="demo1"></textarea>
</form>
</html>
P.S: I'm quite sure, this is not a bug, but I couldn't find any other support channel for SimpleMDE.
Since the <script> tag is in the <head>, I believe it's trying to initialize SimpleMDE before the DOM has been loaded. Try moving the scripts down to the bottom, before the closing </html> tag.
I moved the script to the bottom of the html page and it worked. Thanks
my layout.jade
doctype html
html
head
title #{title} xxxTECHNOLOGY
block scripts
script(src='/javascripts/site.js')
link(rel='stylesheet', href='/stylesheets/style.css')
body
.flex-container
header
h1 Neyasiss
nav.nav
ul
li
a(href='/index') Ana Sayfa
li
a(href='/services') Hizmetlerimiz
li
a(href='#') Referanslar谋m谋z
li
a(href='/career') Kariyer
li
a(href='#') 陌leti艧im
.concontainer
.subconcontainer
block subconcontainer
.sidebar
block sidebar
footer Copyright 漏 xxxxTECHNOLOGY
block scriptsEnd
its ok thanks
Most helpful comment
Since the
<script>tag is in the<head>, I believe it's trying to initialize SimpleMDE before the DOM has been loaded. Try moving the scripts down to the bottom, before the closing</html>tag.