Input event not working if value is changed with jQuery val() or JavaScript

后端 未结 7 2104
孤城傲影
孤城傲影 2020-12-28 16:12

If I change the value of an input field programmatically, the input and change events are not firing. For example, I have this scenario:

相关标签:
7条回答
  • 2020-12-28 16:47
    $input.val($input.val() + 'x')
    $input.trigger('change');
    

    The change event only fire when input blur.

    0 讨论(0)
提交回复
热议问题