【发布时间】:2020-07-06 19:34:15
【问题描述】:
这是我的基本 jquery 插件代码,应用此代码后出现错误
未捕获的类型错误:无法设置未定义的属性“前景”
(function($){
$.fn.myPlugin = function(options){
var settings = $.extend({}, $.fn.myPlugin.default, options);
$.fn.myPlugin.default = {
foreground: "red",
background: "green"
};
}
}(jQuery));
在这里我正在尝试使用此插件代码访问它
$.fn.myPlugin.default.foreground = "blue";
$(".testDemo").myPlugin();
有没有人可以帮我解决这个问题!请提出要求
【问题讨论】:
-
没有称为前景的 CSS 样式属性。使用样式“颜色”代替前景
-
请澄清问题。说明你最终想要达到的目标。
标签: jquery