Ideia : Capture actons/events created by MARKDOWN

I was thinking of a way to get around the issue of doing css hacks in order to have a better UIX.

So I thought if it is possible to capture the action in the objects that we introduce through ST.MARKDOWN ?

I believe that if Streamlit could work with the reference of these objects, it would be better than setting css all the time.

In the example that follows I made a small button in BOOTSTRAP where I would like to assign the ONCLICK event to a PYTHON function.

The main idea here is to simply get a reference of the object created in markdown and be able to handle its events!

Any way to do this?

Note: I know that by Selenium it is possible to do something similar!

Example:

def myBootstrapEvent():
        st.success("A Button was clicked !")

    st.markdown('<button name="btn" type="button" onclick="myBootstrapEvent()" class="btn btn-primary">Primary</button>', unsafe_allow_html=True)