Google Chrome change event in input is not fired if char added on keyup

前端 未结 5 1177
心在旅途
心在旅途 2021-01-12 14:31
$(\'input#not-gonna-work\').bind({
    keyup: function(){
        console.log(\'Typed a key\');
        $(this).val($(this).val() + \'.\');// try with any other char         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-12 15:11

    I tried it in IE9 and it has the same behavior as Chrome.

    I don't think it's a bug.

    Using .val(value) on an HTML element will reset the "manually changed" flag and thus no change event will occur (because the user doesn't change anything manually AFTER the val() operation).

提交回复
热议问题