I'm getting this error in my console, and it relates to a js script i'm using (Trumbowyg WYSIWYG: http://alex-d.github.io/Trumbowyg/)
Here's a picture of the browser console with the error:
When I click on (index):166
, it shows this in the source:
id_content
is the id
for the WSYIWYG editor, and this is the required function in my js
file to make it work:
$('#id_content').trumbowyg({
});
I've looked at other solutions and they say to load the jquery script before every other js script, but I'm already doing that and it doesn't solve anything. Does anyone have any idea what the problem is? By the way, I'm using this package to integrate it with django: https://github.com/sandino/django-trumbowyg, not sure if that changes anything. I just load the widget in my forms like this:
class PostForm(forms.ModelForm):
content = forms.CharField(widget=TrumbowygWidget(), required=False)
full html part:
< div >
< textarea
cols = "40"
id = "id_content"
name = "content"
rows = "10" >
< / textarea >
< script >
$("#id_content").trumbowyg({
lang: "en",
semantic: true,
resetCss: true,
autogrow: true,
removeformatPasted: true,
btnsDef: {
image: {
dropdown: ['upload', 'insertImage', 'base64', 'noembed'],
ico: 'insertImage'
}
},
btns: [
['formatting'],
'btnGrp-semantic',
['link'],
['image'],
'btnGrp-justify',
'btnGrp-lists',
'video',
['horizontalRule'],
['removeformat'],
['fullscreen'],
['viewHTML']
],
plugins: {
upload: {
serverPath: '/trumbowyg/upload_image/',
fileFieldName: 'image',
statusPropertyName: 'message',
urlPropertyName: 'file'
}
}
});
< / script >
< / div >
EDIT: keep in mind everything works fine, but I'm still getting this error. This is not a duplicate question, I've tried those solutions and none of them work.
end of the html file, scripts loading fine:
...
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-3.1.1.min.js"><\/script>')</script>
<script src="/static/js/jquery-jvectormap-2.0.3.min.js"></script>
<script src="http://jvectormap.com/js/jquery-jvectormap-world-mill.js"></script>
<script type="text/javascript" src="/static/js/base.js"></script>
<!--<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js"></script>-->
<script src="/static/js/Trumbowyg-master/dist/trumbowyg.js"></script>
</body>