Trigger Real Event with jQuery

JQuery trigger() seems to fire up jQuery-related event handlers. I have some modules that use binding bindings to their own browser. Using the code from https://stackoverflow.com/a/360616/... works for me, but I wonder if there is something built into jQuery that will do this?

Update from comments: apparently, it works for click events on buttons. But not for events, changes in the selected blocks: http://jsfiddle.net/qxpXV/2/

For the record: hacking another library for binding using jQuery does make trigger() , but I really don't want to do this.

+6
source share
1 answer

You can do this by manually activating / dispatching the event (depending on the browser, fireEvent / dispatchEvent ) directly on the DOM element. The code from this answer will handle event dispatching, you just need to execute it for the DOM element and not for the jQuery shell.

+1
source

Source: https://habr.com/ru/post/926793/


All Articles