So, I want to fetch the top computed style of a <div> and put it into a variable. However, that <div> is not yet in the DOM. It will be appended to the DOM by a JavaScript event later (once the user triggers the .onclick() event).
To do that, I tried this:
let style = getComputedStyle(element).top;
However, that won't work since element is not in the DOM yet. The following error appears if I attempt to do so:
So, how can I fetch the top style of a specific element even if that element isn't in the DOM yet?
