开发者

Keyup event firing, change event not

开发者 https://www.devze.com 2023-04-03 22:51 出处:网络
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 a开发者_开发知识库lso watchi

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 a开发者_开发知识库lso 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消