Obtain rootElement dynamically when appending modal