jQuery: noConflict

后端 未结 8 2135
無奈伤痛
無奈伤痛 2020-12-01 12:25

I just cannot work this out. My god it\'s making my brain hurt, so I turn to you, the good people of the internet.

I\'ve been staring at the documentation for the jQ

8条回答
  •  难免孤独
    2020-12-01 13:11

    You should post an example that isn't working. I bet we'd clear it up immediately.

    I don't believe noConflict is a 'block' exactly. You use noConflict to tell jQuery that you want it to remove anything it declares from the global JavaScript namespace (because you want to load jQuery again and reuse those names).

    On a page with more than 1 instance of jQuery loaded, both instances should use noConflict. I don't know if it's possible to load a second instance of jQuery if there's already an instance loaded and that instance didn't call noConflict.

    @SLaks and @galambalazs: Sometimes you're writing a small amount of content that will be displayed within a larger page, such as a portal. The portal already uses a(n outdated) version of jQuery, but you need a newer version. Also you don't control the larger portal page, just the content you're writing that will be displayed within it.

    This scenario accurately describes real work I do commonly.

提交回复
热议问题