Any even to detect when the “Class” attribute is changed for a control

风格不统一 提交于 2019-12-02 09:33:19

You may use onpropertychange(IE) and DOMAttrModified (others)

You'll have to use 3 things:

  1. onpropertychange event, for IE < 9
  2. DOMAttrModified, works in IE9, Opera, Firefox, and not regrettably in all others as Dr.Molle suggests
  3. Everything else - must resort to setInterval loop, that checks if value changed, this includes webkit browsers (chrome and safari), since they still don't have DOMAttrModified support, so - you'll have to resort to loop check for those browsers.

There is jQuery plugin which implements this (there is also a demo on the page):

http://darcyclarke.me/dev/watch/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!