Hello!
How can I access a streamlit element? Iโve been trying to use JS DOM by st.components, but nothing happens.
Any suggestion?
Below my code trying to scroll to the subheader by class name.
st.components.v1.html("""<script>document.getElementByClassName("markdown-text-container stMarkdown").scrollIntoView()</script>""")
Hi @Alexandre_FG, welcome to the Streamlit community!
The html()
and iframe()
methods donโt work this way, they are both static components, meaning they only display content they donโt return values. To be able to pass values back and forth, youโd need to use the bi-directional component functionality, which is significantly more involved than a quick line or two in a Streamlit app.