Sam
Sam

Reputation: 4339

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);
});

Upvotes: 3

Views: 836

Answers (1)

Robin Castlin
Robin Castlin

Reputation: 10996

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.

Upvotes: 2

Related Questions