How to refer to a div in custom html from python and vice-versa

Sounds like a cool project.

Have you checked out the documentation on using JavaScript with anvil?

The basic premise is that your custom HTML form should have a method. And then you call this method from JavaScript with arguments.

In your custom HTML you can create div elements with ids.
Anvil components don’t have ids so you could add roles which are classes. Or you can create custom components that have ids if you have to target an id.

If you get stuck feel free to post a clone link and we can take a look and see if we can help.

1 Like