JQuery and Prototype Events

I have a prototype code that fires on a “load” event:

  Event.observe($(imageEl), 'load', this.someFunction.bind(this));

When I create a 'Real' event using jQuery code, like

  jQuery(...imageEl selector...).attr("src", filename);

it runs the prototype code (someFunction). Good!

Next, I try to run the Prototype code using the jQuery trigger:

  jQuery(...imageEl selector...).trigger('load');

But now nothing happens, i.e. this line does not run the prototype code.

Any idea how to trigger a Prototype event from jQuery?

+3
source share
1 answer

You must call the handler by passing the necessary arguments directly or by running your own DOM event .

: prototype fire jquery trigger , native.

, :

+2

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


All Articles