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

后端 未结 4 1567
借酒劲吻你
借酒劲吻你 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:58

    I had the same problem. The oninput event fires for backspace, del, etc in Chrome and FF but not IE9.

    However, that OnKeyUp does actually fire backspace, del etc in IE9 but not Chrome FF, so the opposite.

    I added a specific IE javascript file named ieOverrides.js:

    
    

    Then in the js file I switched the event handlers:

    $(document).ready(function(){
        $("#search").off('input');
        $("#search").on('keyup', function(){
            search(this.value);
        });
    });
    

    Hope that helps.

提交回复
热议问题