Replies: 1 comment
-
Hi @vahuynh12, This is a known problem (see #3033): Elements on hidden tabs don't get mounted until the tab is shown for the first time. Unfortunately, we still don't know how to avoid that. To trigger some code when the tab is shown, you can subscribe to the change event of tabs.on_value_change(...) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question
Hello,
I am still very new to HTML and JavaScript so I am not sure if what I am asking below makes sense.
In the code below, my page has 2 tabs and 2 tab panels. I created a div in the 2nd tab panel (using
ui.element("div")
and want to be able to retrieve that element through JavaScript viadocument.getElementById
.However, because the 1st tab panel is the default tab panel shown on the page load,
document.getElementById
returns null for the div. I suspect the elements of the 2nd tab panel are not yet loaded(?). If I change the default tab panel to by the 2nd tab panel, thendocument.getElementById
does return the desired element.I am trying to either
Of these approaches, the 2nd option seems preferable.
I would appreciate any advice on how to go about this. Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions