I tried the below code for that, but it adds pagedown buttons to only the first .wmd-input
.
if ($(".wmd-input").length > 0) {
var converter = new Markdown.Converter();
var help = function () { alert("Do you need help?"); }
var options = {
helpButton: { handler: help },
strings: {quoteexample: "whatever you're quoting, put it right here"}
};
var editors = [];
var i = 0;
$(".wmd-input").each(function() {
editors[i] = new Markdown.Editor(converter, "", options);
editors[i].run();
i = i + 1;
});
}
Looks like i have to add unique ID for each element of wmd. I mean
wmd-input
,wmd-preview
andwmd-button-bar
. I modified this id attributes programmatically. This can be done with modifying manually but my length of inputs are dynamic.So when this ID attributes is set, i called the editor with postfix variable and problem solved.