How to wait until an element exists for dojo?

In dojo, is there a way to get notified when an element of a certain class (or containing certain text) was created?

In jQuery there is almost the same question asked in here . But I would like to know if there is a similar solution for dojo. Thanks!

+7
source share
1 answer

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); } }); }); 
+6
source

All Articles