I have the following javascript in a plugin.
AJS.bind(“rte.init.ui”, function() {
var body = AJS.$("#wysiwygTextarea_ifr").contents().find("#tinymce");
console.dir(body);
body.children().each(showMacro);
});
function showMacro(index, element) {
console.dir(element);
}
The console shows that “body” has 7 children, but the each() method appears to only be processing the first one. This is not the only issue I am having. The find() method only seems to find the first child, and if the selector does not match that first child, it finds nothing. I suspect they are related.
NOTE: body.find(*) only returns two elements. The first child, and it’s first child. The grandchild has no children.
NOTE: One possibility is the document is not fully loaded when “rte.init.ui” is called. If that is the case, what trigger should I bind to?