In dojo, is there a way to get notified when an element of certain class (or contain certain text) has been created?
There is an almost exactly the same question asked in here for jQuery. But I'd like to know if there is a similar solution for dojo. Thank you!
For dojo 1.7, based on the JQuery answer, I would do :
require(["dojo/on", "dojo/_base/array"], function(on, array){
on(dojo.doc, "DOMNodeInserted", function(evt){
var classes = dojo.attr(evt.target, "class").split(" ");
if (array.indexOf(classes, "myclass") > -1) {
console.debug("Inserted node with class myclass", evt.target);
}
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With