0

I have multiple HTML fragments that are inserted into my DOM as the result of AJAX call-backs.

Each of these fragments will contain a text box whose class is "quantity".

What I want to do is to create an "on change" event handler that fires whenever one of these textbox's text value is changed. However, when that event is fired/handled, I need to know WHICH specific textbox was updated.

Okay, using jQuery, I have the following that fires in my "Lists.initHandlers" method:

$(document).on('change', $('#divABC').find(".quantity"), List.quantityChanged);

And my "List.quantityChanged" event handler happily fires when I update the quanity.

The problem is that when I reference "this" within the event handler, I get the whole document, and not the element that triggered the event.

I have tried to capture the element using syntax similar to:

$(document).on('change', $('#divABC').find(".quantity"), {ctrl: this}, List.quantityChanged);

but when I attempt this, the handler is never fired (even when I change the signature to expect an argument).

Any guidance here would be most appreciated.

Thanks

Griff

4

2 に答える 2