oninput in IE9 doesn't fire when we hit BACKSPACE / DEL / do CUT

后端 未结 4 1570
借酒劲吻你
借酒劲吻你 2021-01-04 02:32

What\'s the cleanest solution we use to overcome the problem that IE9 doesn\'t fire the input event when we hit BACKSPACE / DEL / do CUT?

By cleanest I mean code

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-04 02:52

    IE9 doesn't fire the oninput event when characters are deleted from a text field using the backspace key, the delete key, the cut command or the delete command from the context menu. You can workaround the backspace/delete key problem by tracking onkeyup. You can also workaround the cut command problem by tracking oncut. But the only way I've found to workaround the context delete command is to use the onselectionchange event. Fortunately if you use onselectionchange you won't have to track oncut or onkeyup.

    Here's some example code based on this technique I've written about:

    
    
    
    

提交回复
热议问题