Intercept button pressed event in keycloak theme (I need to create a loading spinner)

Hello together, I have a problem with the Terms and Conditions Page in Keycloak. If one pressed the accept button it might take a while till the server responses with the next page. I therefore need to add and overlay and loading spinner to the page once the ok button is pressed. I am not very familar with the ftl templates. Would be great if someone could give me directions how I could realize the behavior. Thanks for your help