Does anyone know the equivalent of this event in IE ?
Or may be a way around for this logic:
document.addEventListener("DOMSubtreeModified", function (e) {
if ($(e.target).hasClass("myclass")) {
var getId= e.target.id;
}
}, false)
This works fine in FF, Chrome, Safari, IE 9 or higher.
Need an equivalent logic for IE8 and IE7
Does anyone know the equivalent of this event in IE ?
Or may be a way around for this logic:
document.addEventListener("DOMSubtreeModified", function (e) {
if ($(e.target).hasClass("myclass")) {
var getId= e.target.id;
}
}, false)
This works fine in FF, Chrome, Safari, IE 9 or higher.
Need an equivalent logic for IE8 and IE7
Share Improve this question asked Nov 8, 2013 at 22:19 AniAni 4,5234 gold badges28 silver badges32 bronze badges 5-
1
A short answer: an equivalent event doesn't exist in IE<9. However, changes to some elements/properties fire
onpropertychange
event. – Teemu Commented Nov 8, 2013 at 22:24 - you can always ping and trigger a custom event upon a change detection... getElemementsByTagName("*") will change it's .length property when elements are added or removed. – dandavis Commented Nov 8, 2013 at 22:28
- I'd suggest writing your code in such a way that you don't depend on these kinds of events. – Kevin B Commented Nov 8, 2013 at 22:28
- @dandavis That's what my 2nd option was. – Ani Commented Nov 8, 2013 at 22:59
- @KevinB : I am implementing other option now, which won't need this event :( – Ani Commented Nov 8, 2013 at 23:00
1 Answer
Reset to default 12I had a similar problem (though I was using jQuery). I solved it by using the following
//chrome / ff
$(".myClass").on("DOMSubtreeModified", function() {
//do stuff
});
//i.e.
$(".myClass").on("propertychange", function() {
//do same stuff
});
This can be further bined into a single event listener
$('.myClass').on('DOMSubtreeModified propertychange', function() {
// do stuff
});