propertychange无法在IE11中运行

时间:2014-07-17 05:50:07

标签: javascript jquery internet-explorer

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

这是我的代码和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.

1 个答案:

答案 0 :(得分:0)

使用DOMSubTreeModified使其在IE11中工作(IE11操作DOM):

$('input').on('DOMSubTreeModified propertychange', function(){
        console.log(this.value);
    });
相关问题