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

后端 未结 7 2106
孤城傲影
孤城傲影 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.

提交回复
热议问题