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

后端 未结 16 1331
天命终不由人
天命终不由人 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:55

    I had a similar requirement (twitter style text field). Used onkeyup and onchange. onchange actually takes care of mouse paste operations during lost focus from the field.

    [Update] In HTML5 or later, use oninput to get real time character modification updates, as explained in other answers above.

提交回复
热议问题