javascript 带有 propertychange 和 DomAttrModified 的 JQuery 绑定事件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18296920/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 11:22:31  来源:igfitidea点击:

JQuery binding events with propertychange and DomAttrModified

javascriptjquery

提问by Gurpreet Randhawa

I am working on an application and i have use a property where a small change in textareashould alert the user, i tried onChangeevents, but that does not server the Purpose, i found onPropertyChangeseems to be working fine in IE only, i had to make this application cross browser was looking something like an attribute of onpropertychangewith other browsers. Looked at DomAttrModified, but that seems not working any idea, how can i do: Here is my below code:

我正在开发一个应用程序,我使用了一个属性,其中textarea中的一个小变化应该提醒用户,我尝试了onChange事件,但这并没有达到目的,我发现onPropertyChange似乎只在 IE 中工作正常,我有使这个应用程序跨浏览器看起来像其他浏览器的onpropertychange属性。看着DomAttrModified,但这似乎没有任何想法,我该怎么办:这是我的以下代码:

$("#info").bind('keyup keydown keypress onDOMAttrModified propertychange', function(evt)
    { var keyCode = evt.which; 
        var text_area =$(this).val(); 
    } 
});

回答by Tushar Gupta - curioustushar

try

尝试

replace onDOMAttrModifiedwith DOMAttrModified

替换onDOMAttrModifiedDOMAttrModified

$("#info").bind('keyup keydown keypress DOMAttrModified propertychange',