Change event on input element in table not fired on column sort or clicking page back/next
Change event on input element in table not fired on column sort or clicking page back/next
If I have an input text element in a table with dataTable, and a change/focusout/blur handler on it, sorting on columns/navigating to another page prevents the attached handlers from firing.
Repro steps :
1. Go to http://datatables.net/examples/plug-ins/dom_sort.html
2. Attach a new live change handler using Firebug/IE Dev tools : $('#example > tbody > tr >td:eq(3) input').live('change', function () { alert('input box changed'); });
3. Go to the first row, 'Engine version' column, and change the value there. Without clicking anywhere else on the screen, click on any column header/ navigate to another page.
4. The alert will not fire.
I think an event.preventDefault in fnClick prevents this. Is there a way I can work around this problem ?
Repro steps :
1. Go to http://datatables.net/examples/plug-ins/dom_sort.html
2. Attach a new live change handler using Firebug/IE Dev tools : $('#example > tbody > tr >td:eq(3) input').live('change', function () { alert('input box changed'); });
3. Go to the first row, 'Engine version' column, and change the value there. Without clicking anywhere else on the screen, click on any column header/ navigate to another page.
4. The alert will not fire.
I think an event.preventDefault in fnClick prevents this. Is there a way I can work around this problem ?
This discussion has been closed.
Replies
if you want a key-by-key change, use keyup or keydown or keypress events
I don't want a key-by-key change, only want to record the final value in a variable after change/blur.
Any ideas on how to get it to work in IE (without having to work with the key related events ?)