Hi. I am trying to evaluate a div on the topic show page. In order to do so, I need to run a function after the dom on the topic show page is done loading.
In normal javascript, i’d run “window.onload = function()…” for this. However, this onload function doesn’t seem to work when the topic is navigated to from within the site.
How can I run the function after the dom is fully loaded?
I have tried the following, and none of them seem to work:
withPluginApi("0.11.1", api => {
api.modifyClass('component:topic-title', {
didRender: function(){ //tried "didInsertElement" as well
//run function--still runs before all the divs have loaded
}
}),
api.decorateCookedElement(function() {
//run function--still runs before all the divs have loaded.
})
})