Best way to track onchange as-you-type in input type=“text”?

后端 未结 16 1130
天命终不由人
天命终不由人 2020-11-22 08:42

In my experience, input type=\"text\" onchange event usually occurs only after you leave (blur) the control.

Is there a way to

16条回答
  •  隐瞒了意图╮
    2020-11-22 08:47

    Update:

    See Another answer (2015).


    Original 2009 Answer:

    So, you want the onchange event to fire on keydown, blur, and paste? That's magic.

    If you want to track changes as they type, use "onkeydown". If you need to trap paste operations with the mouse, use "onpaste" (IE, FF3) and "oninput" (FF, Opera, Chrome, Safari1).

    1Broken for