jQuery get input value after keypress

后端 未结 9 1658
野趣味
野趣味 2020-11-28 21:40

I have the following function:

$(document).ready(function() {
    $(\"#dSuggest\").keypress(function() {
        var dInput = $(\'input:text[name=dSuggest]\'         


        
9条回答
  •  余生分开走
    2020-11-28 22:13

    Just use a timeout to make your call; the timeout will be called when the event stack is finished (i.e. after the default event is called)

    $("body").on('keydown', 'input[type=tel]', function (e) {
        setTimeout(() => {
            formatPhone(e)
        }, 0)
    });
    

提交回复
热议问题