I have a div
that has additional classes added to it programmatically. How can I detect the class name change without using this setInterval
implementation?
setInterval(function() {
var elem = document.getElementsByClassName('original')[0];
if (elem.classList.contains("added")) { detected(); }
}, 5500);
MutationObserver?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…