jquery / jquery/learn.jquery.com

Need to resolve conflict to Multiple jQuery's from single page

Open
#814 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
915
Forks
471
PR merge metrics
No merged PRs in 30d

Description

I have initialized window.jQuery = jQuery; now, i want to add some prototype functions with different jQueries, like
var a = window.jQuery;
var b = window.jQuery;
a.fn.helloWorld = () => 1;
b.fn.helloWorld = () => 2;

console.log(a.fn.helloWorld()); // 2
console.log(a.fn.helloWorld()); // 2

In this case, when i use noConflict from a variable, then b has undefined then, how can i use jquery for this case?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue's jQuery variable example and the documented noConflict behavior. Clarify the supported way to use multiple jQuery instances, then update the relevant learning content so the expected behavior and usage are explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.