属性改变不工作在IE11

propertychange not working in IE11

本文关键字:IE11 工作 改变 属性      更新时间:2023-09-26

我使用propertychange来捕获输入值。它不能在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.

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

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