jQuery-节点属性更改时的事件 [英] jQuery - Event for when an attribute of a node changes
问题描述
我有一个带有外部javascript库的网页,还有我自己的额外代码.外部库不能更改.它操作dom元素,添加新元素,更改属性(例如,某些<img>
节点上的src
等).我正在使用jQuery.当节点的属性值更改时,是否会触发任何事件处理程序?
I have a webpage with an external javascript library, and my own extra code. The external library can't be change. It manipulates dom elements, adds new ones, changes attributes (e.g. src
on some <img>
nodes, etc.). I am using jQuery. Is there any event handler that is fired when the value of an attribute changes of a node?
即无论如何,当有人更改<img>
的src
时,我是否可以检测到(在jQuery中?)
i.e. is there anyway I can detect (in jQuery) when the src
of an <img>
is changed (by someone else?)
推荐答案
您可以使用 jQuery监视插件来检测属性中的更改.
You can go for the jQuery watch plugin to detect changes in the attributes.
也查看此信息:
http://darcyclarke.me/development/detect-attribute-changes -with-jquery/
这篇关于jQuery-节点属性更改时的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!