bootstrap-markdown-editor
bootstrap-markdown-editor copied to clipboard
Given methods not working
Hi @inacho
$('#myEditor').markdownEditor('content'); => returns "" even though I have content in editor
$('#myEditor').markdownEditor('setContent','abcdef') => not working
Please help in fixing.
Thanks
this could be a dupe of #24 and I have the same issue
Both methods fail to find the element they are after. They need to go one step up through parent:
content: function () {
var editor = ace.edit(this.find('.md-editor')[0]);
return editor.getSession().getValue();
},
setContent: function(str) {
var editor = ace.edit(this.find('.md-editor')[0]);
editor.setValue(str, 1);
}
Shoud be
content: function () {
var editor = ace.edit(this.parent().find('.md-editor')[0]);
return editor.getSession().getValue();
},
setContent: function(str) {
var editor = ace.edit(this.parent().find('.md-editor')[0]);
editor.setValue(str, 1);
}