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

后端 未结 16 1146
天命终不由人
天命终不由人 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 09:04

    I think in 2018 it's better to use the input event.

    -

    As the WHATWG Spec describes (https://html.spec.whatwg.org/multipage/indices.html#event-input-input):

    Fired at controls when the user changes the value (see also the change event)

    -

    Here's an example of how to use it:

    
    

提交回复
热议问题