var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;//浏览器兼容 var config = {attributes: true, childList: true, attributeFilter: ['disabled']}//配置对象 var observer = new MutationObserver(function (mutations) {//构造函数回调 mutations.forEach(function (record) {//在此处console.log(record) 可以查看到具体回调参数 if (record.type == "attributes") {//监听属性 //do any code } if (record.attributeName == "disabled") {//监听自定义属性 //do any code } if (record.type == 'childList') {//监听结构发生变化 //do any code } }); }); observer.observe($("#id")[0], config);//注意这里必须带上下标,不管你是id还是name或者class之类的