ie 8 input 事件兼容

2020-12-28  本文已影响0人  A_dfa4
<div>
  <textarea name="" id="" cols="30" rows="10"></textarea>
</div>

<script src="./jquery/jquery.min.js"></script>
<script>
  $(function () {
    $("body").on("input propertychange", "textarea", function () {
      console.log(888);
    }); // 不支持on注册??? 我试的没有效果不确定
    //propertychange
    $('textarea').bind('input', function() {
      console.log($(this).val());
    }); // 在ie不行
    $('textarea').bind('input propertychange', function() {
      console.log($(this).val());
    }); // 在ie可以
  }) 
</script>

做一个政府项目, 兼容ie8 - -, 选择了layui框架,在多选时选择了 form-select4插件,客户说需要搜索在 谷歌好好的 在ie 挂了..... 原因是ie8 不兼容input事件???(在源码320行左右),ie的propertychange好像不行on 注册 偷懒直接加了个 keyup事件 - -...

借鉴地址:https://www.cnblogs.com/lhb25/archive/2012/11/30/oninput-and-onpropertychange-event-for-input.html

上一篇下一篇

猜你喜欢

热点阅读