Search code examples
jqueryprototypejsdom-events

jQuery change() not firing prototype event handlers


I have an existing prototype codebase that does stuff on selectbox changes...

I have used jQuery that generates (styled) unordered-lists and I wish to proxy clicks to that list to my selectbox... This all works fine (calling val() on selectbox), but prototype doesnt pick up on these changes, even when I explicitly call change() on the selectbox... Anyone know what is going on?

I could post a bunch of code but it is all very basic, I think the only relevant part is:

parent_obj.val(selected_idx).change();

Which does change the selected item in my selectbox, but doesn't fire my prototype event handler.

edit:

There will probably be an answer about using trigger() etc... that doesn't seem to work either:

parent_obj.val(selected_idx).click().change().trigger('click');
parent_obj.find('option value[' + selected_idx + ']').click().change().trigger('click');

Solution

  • I ended up using prototype Event.simulate as suggested by this answer;

    Trigger an event with Prototype