开发者

keypress, keydown, keyup value of input box AFTER event

$("#last_4_cc").keyup(function()
{
    $.post('<?php echo site_url("sales/set_last_4_cc");?>', {last_4_cc: $('#last_4_cc').val()});    
});
开发者_如何学运维

When doing keypress() or keydown() I get the value before the key is inputed, when I do key up, I get the val() for the after the key is inputed.

Example:

Cur Value: 333

keyPress "3" Cur Val 333

Cur Value: 333

keyUp "3" Cur Val 3333

Why is this?


This is the expected behavior? KeyPress and KeyDown events are supposed to be triggered before the default action is performed, KeyUp fires afterwards.

See here: http://www.quirksmode.org/dom/events/keys.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜