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

Jqn00bJqn00b Posts: 2Questions: 0Answers: 0
edited August 2011 in General
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 ?

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    usually change event for text boxes only occurs on blur (if changed). this can vary from browser to browser (I think).

    if you want a key-by-key change, use keyup or keydown or keypress events
  • Jqn00bJqn00b Posts: 2Questions: 0Answers: 0
    Yes, I could only repro with IE. Works without a hitch on Chrome :(
    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 ?)
This discussion has been closed.