1

在以下示例中,用户尝试$在加载了 jQuery 的开发人员控制台中重新分配美元函数。

[18:39:57.071] $ = function(){"hello"}
[18:39:57.072] (function (){"hello"})
[18:40:00.367] $
[18:40:00.381] (function ( selector, context ) {
        // The jQuery object is actually just the init constructor 'enhanced'
        return new jQuery.fn.init( selector, context, rootjQuery );
    })

为什么$没有重新定义美元函数?

4

1 回答 1

1

也许您正面临“范围”问题,并且您没有$在“全局”范围内重新定义。

你可以试试这个:window.$ = function(){"hello";}

于 2013-04-15T08:17:11.870 回答