Haensl D. Haensl D. - 4 months ago 46
HTML Question

Keep track of changes in html table/form

What I'm trying to achieve is to keep track of any changes (e. g. user input, field added, ...) within a

In my specific scenario users can edit fields, add rows, add fields, remove fields and rows, select something in
-elements, etc.

Of course I could just attach my "change"-listener to all of those actions, but I think there must be a better way.

I tried attaching a
$('#myTable tbody').change()
-listener to it, but that doesn't fire...

Maybe some of you know of a way to keep track of table changes without having to subscribe to every possible user action manually?


To answer my own question:

I decided on doing it kinda like @mdsl suggested:

I now listen for changes like this:

$('#myTable tbody').on('focusout', 'input, select, checkbox', myListener);