jquery函数不支持

时间:2011-11-29 09:41:00

标签: 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;
    }

1 个答案:

答案 0 :(得分:4)

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

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

如果这没有任何区别,您可以向我们提供文件,这会导致错误并确保使用任何浏览器开发人员工具实际加载了脚本文件