javascript - jquery函数不支持

标签 javascript jquery jsp

我有一个 jQuery 插件 tzineClock。但是当我尝试调用它时

$(document).ready(function(){
    /* This code is executed after the DOM has been completely loaded */
    $('#fancyClock').tzineClock();
});

它正在抛出错误,因为“不支持此功能”。谁能告诉我错误可能是什么?这是 tzineClock 代码:

$.fn.tzineClock = function(opts){

        // "this" contains the elements that were selected when calling the plugin: $('elements').tzineClock();
        // If the selector returned more than one element, use the first one:

        var container = this.eq(0);     
        if(!container)
        {
            try{
                console.log("Invalid selector!");
            } catch(e){}

            return false;
        }

        if(!opts) opts = {}; 

        var defaults = {
            /* Additional options will be added in future versions of the plugin. */
        };

        /* Merging the provided options with the default ones (will be used in future versions of the plugin): */
        $.each(defaults,function(k,v){
            opts[k] = opts[k] || defaults[k];
        })

        // Calling the setUp function and passing the container,
        // will be available to the setUp function as "this":
        setUp.call(container);

        return this;
    }

最佳答案

这可能是因为 jQuery 尚未加载 tzineClock 函数,因此它“不受支持”。

检查您引用插件的脚本标签,并确保 tzineClock 脚本标 checkout 现在 jQuery 脚本标签之前

如果这没有什么区别,您能否向我们提供导致错误的文件,并确保脚本文件已使用任何浏览器开发工具实际加载.

关于javascript - jquery函数不支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8308594/

相关文章:

javascript - JavaScript 的编译器是否因网络浏览器而异

javascript - Electron v1.7 : Close, 最大化和最大化

javascript - 事件委托(delegate)不工作jquery

javascript - jQuery animatescrolltop() 在 IE10 中不向下滚动

javascript - 无法使react-chartjs选项生效

jQuery 网卡验证

jquery - 计算具有变化值的多个 div

eclipse - 未定义的属性名称(aria-hidden)

java - 无法显示隐式 EL(表达式语言)范围对象

java - 如何从 JavaScript 向 servlet 发送请求?