How to access a streamlit element?

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.

Iโ€™ll try. Thanks!