我是 jQuery 新手(说实话,我使用它只是因为 this WMD 编辑器需要它)。
无论如何,我正在查看 jQuery 代码(转到上面的链接并查看 jquery.wmd.js),并且有选项默认值:
WMDEditor.defaults = { // {{{
version: 2.0,
output_format:"markdown",
lineLength:40,
button_bar: "wmd-button-bar",
preview: "wmd-preview",
output: "wmd-output",
input: "wmd-input",
...
这让我相信有一种方法可以将选项作为参数传递给函数。我正在寻找一种传递 helpLink
选项的方法。我确信它真的很简单,就像facepalm 一样简单,但我看不懂 jQuery,也没有文档。有人可以告诉我如何将选项参数传递给此
$(function() {
$(".wmd-input").wmd();
});
最佳答案
如果插件设置正常,您可以执行以下操作:
var defaults = {
version: 2.0,
output_format:"markdown",
lineLength:40,
button_bar: "wmd-button-bar",
preview: "wmd-preview",
output: "wmd-output",
input: "wmd-input"
// and then keep on going
}
$(function() {
$(".wmd-input").wmd(defaults);
});
关于javascript - RobinBrouwer WMD - 阅读基本 jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6585240/