2014-07-17 150 views
0

我正在使用propertychange来获取输入值。它不适用于ie11。任何人都建议我使用它来处理所有ie的正确方法。propertychange not in IE11

这里是我的代码和HTML:

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <title>PropertyChange</title> 
    <script src="jquery-1.11.1.min.js"></script> 
    <script src="propChange.js"></script> 
</head> 
<body> 
    <input type="text"> 
</body> 
</html> 

脚本:

jQuery(document).ready(function($) { 
    $('input').on('propertychange', function(){ 
     console.log(this.value); 
    }); 
}); 

在控制台中我得到这个:

DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337 

HTML1300: Navigation occurred. 
+0

是否有任何控制台错误,请检查并提供该 –

+0

使用'$( '输入')的的jsfiddle上( '变'。 )' – Heejin

+1

发现此问题:“onpropertychange事件仅支持与传统attachEvent IE-only事件注册模型结合使用,该模型自Windows Internet Explorer 9开始支持W3C标准”addEventListener“事件模型后不再使用。 - http://msdn.microsoft.com/en-us/library/ie/ms536956(v=vs.85).aspx – elclanrs

回答

0

使用DOMSubTreeModified使它在IE11工作(IE11操纵DOM):

$('input').on('DOMSubTreeModified propertychange', function(){ 
     console.log(this.value); 
    }); 
+0

我试过了,不行! – 3gwebtrain