开发者

How does jQuery's noConflict function work?

Hey, I was just looking at the docs for the noConflict function and it says nothing about how it works (obviously). I just wondered if anyone knew.

Does it unset $? (delete window.$?)

Any suggestions开发者_如何学编程 will be much appreciated.


You can check the source code:

// Map over the $ in case of overwrite
    _$ = window.$

//....
noConflict: function( deep ) {
        window.$ = _$;

        if ( deep ) {
            window.jQuery = _jQuery;
        }

        return jQuery;
    }


It reverts $ to what it was before jQuery was loaded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜