Skip to content

Event handlers are not triggered across multiple instances #4815

Closed
@torotil

Description

@torotil

Description

When I have multiple jQuery instances on the same page. Events triggered using $.trigger() with one instance don’t execute event handlers bound with $.on() using another instance.

Link to test case

https://jsbin.com/dawajojave/edit?html,js,output

In the test case there is a select. Two versions of jQuery are injected. Each of them binds to $('select').on('change') and updates the value in the first list. In the second list there is a button triggering a change in the select value using $('select').val('grapes').trigger('change') for each version.

Expected result

Both values in the first list are changed regardless of how the change was made to the select.

Actual result

While both jQuery instances get notified about changes to the select when it’s used directly they only get the change event from ”their own” buttons.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions