监听input内容改变的oninput与onpropertychange在ie9的bug
2013-11-25 11:28
411 查看
在做autocomplate的时候发现,ie9中,剪切、退格、删除不触发oninput事件,而ie9和ie9+已经移除了onpropertychange事件。
只好尝试添加退格、delete、剪切事件,来触发onpropertychange
只好尝试添加退格、delete、剪切事件,来触发onpropertychange
var input = $("#J_autocomplete"); var fn = function(){ // console.log('value changed') } input.bind('input.autocomplete',fn) .bind('propertychange.autocomplete',function(e){ if(e.originalEvent.propertyName && e.originalEvent.propertyName == 'value'){ fn.call(this,e); } }); //ie9支持addEventListener,ie10开始支持FileReader api if(documnt.all && typeof FileReader === 'undefined' && window.addEventListener){ //退格与删除 input.bind("keydown.autocomplete", function(e) { var key = e.keyCode; (key == 8 || key == 46) && $(this).trigger('input.autocomplete'); }); //剪切 input.bind("cut.autocomplete", function(e){ $(this).trigger('input.autocomplete') }); }
相关文章推荐
- 监听文本框内容改变事件之oninput、onchange与onpropertychange事件的用法和区别
- 捕获input 文本框内容改变的事件(onchange,onblur,onPropertyChange比较)
- 实时监听输入框值变化的完美方案:oninput & onpropertychange(真正完美,支持ie9以下,ie10,chrome)
- 捕获input 文本框内容改变的事件(onchange,onblur,onPropertyChange比较)
- 捕获input 文本框内容改变的事件(onchange,onblur,onPropertyChange比较)
- 捕获input 文本框内容改变的事件(onchange,onblur,onPropertyChange比较)
- 捕获input 文本框内容改变的事件(onchange,onblur,onPropertyChange比较)
- 捕获input 文本框内容改变的事件(onchange,onblur,onPropertyChange比较)
- 监听输入框值变化的最佳方案 oninput 和 onpropertychange (实时监控文本框改变的最佳方案)
- 捕获input文本框内容改变的事件(onchange,onblur,onPropertyChange比较)
- 实时监听输入框值变化的完美方案:oninput & onpropertychange
- 实时监听输入框值变化的完美方案:oninput & onpropertychange
- 实时监听输入框值变化的完美方案:oninput & onpropertychange
- onpropertychange、oninput监听input输入框值实时变化
- asp.net中,js改变textBox的文本内容的触发事件是onpropertychange
- js与jquery实时监听输入框值的oninput与onpropertychange方法
- 实时监听输入框值变化的完美方案:oninput & onpropertychange
- js与jquery实时监听输入框值的oninput与onpropertychange方法
- js/jquery 实时监听输入框值变化的完美方案:oninput & onpropertychange
- 实时监听输入框值变化的完美方案:oninput & onpropertychange