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

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

    Please, judge next approach using JQuery:

    HTML:

    
    

    Javascript(JQuery):

    $("#inputId").keyup(function(){
            $("#inputId").blur();
            $("#inputId").focus();
    });
    
    $("#inputId").change(function(){
            //do whatever you need to do on actual change of the value of the input field
    });
    

提交回复
热议问题