要实现一个库,我必须将JQuery升级到它的3.1.1版本。Jquery更新到3.1.1 - >匿名函数
它了相当不错,尽管很容易固定,一些研究,
但一个我使用我的网站上的小脚本不工作了,我的JS知识几个废弃的函数都不甚理想。
有问题的脚本是国别(它显示国家名称/标志的输入列表中),这里有我在我的控制台获取错误:
r.fn.load @ jQuery的3.1.1。 min.js:4
(匿名功能)@ countrySelect.js:32
(匿名功能)@ countrySelect.js:8
(匿名功能)@ countrySelect.js:10
,这里是脚本的第34行:
// wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
(function(factory) {
if (typeof define === "function" && define.amd) {
define([ "jquery" ], function($) {
factory($, window, document);
});
} else {
factory(jQuery, window, document); // <------ LINE 8
}
})(function($, window, document, undefined) { // <------ LINE 10
"use strict";
var pluginName = "countrySelect", id = 1, // give each instance its own ID for namespaced event handling
defaults = {
// Default country
defaultCountry: "",
// Position the selected flag inside or outside of the input
defaultStyling: "inside",
// Display only these countries
onlyCountries: [],
// The countries at the top of the list. Defaults to United States and United Kingdom
preferredCountries: [ "fr", "us", "gb", "ru", "cn" ]
}, keys = {
UP: 38,
DOWN: 40,
ENTER: 13,
ESC: 27,
PLUS: 43,
A: 65,
Z: 90
}, windowLoaded = false;
// keep track of if the window.load event has fired as impossible to check after the fact
$(window).load(function() { // <------ LINE 32
windowLoaded = true;
});
我真的很感激一些帮助理解为什么它不工作了,我不能弄明白为止。我应该如何解决这个问题?
什么是实际的错误? JavaScript通常输出错误是什么,不仅仅是“在哪里”,它是 –