Manipulate content of EasyMDE field with jQuery

299 views Asked by At

I'm looking for a good way to be able to manipulate the contents of easyMDE through javascript or jQuery.

It appears that a textarea that is loaded with easyMDE cannot be referenced in an easy way to update its contents as easyMDE creates some sort of shadow field that syncs it contents to the actual textarea.

Updating the actual textarea with eg

$("#description").val("Some text");

updates the original textarea contents, but it is not shown in the easyMDE field.

Using the method of easyMDE

easyMDE.value("Some text);

from does not work due the scoping of the variable easyMDE

When fiddling around with the easyMDE field code and making the easyMDE a global variable makes it possible to update the field content, but there must be a better way I'm sure

0

There are 0 answers