简体   繁体   中英

Keyup event firing, change event not

I am building a bunch of controls dynamically.

Essentially I am attaching a keyup to the textbox to detect when up/down is pressed in a table to move between cells. I am also watching for when the input field changes, because I then add that control to an array for posting back when the user hits save.

This works when I tab between controls or click from one control to the next. However, If I use the arrow keys as coded to move between fields, the change event does not fire.

My event handling code looks like this:

$('input[id^="reo_"]').bind('change', function () {
   rowDetailChange($(this));
});

$('input[id^="reo_"]').bind('keyup', function (e) {
   processKeyUp($(this), e);
});

The change event fires upon focus out, blur and enter with the condition that the content has been altered. This is because the event would fire a great lot elsewise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM