Hi,
I just read your attachment again. I think your idea is to add or remove class when user click on a container right? If so I think you can do without using javascript as following:
1. Add a block with a local variable like IsClicked (type boolean and default False).
2. Inside block add a container widget and for style classes can add like: If(IsClicked, "clicked-class", "") <= this mean you add "clicked-class" or remove it base on IsClicked value.
3. For the container you can add onclick Event with Handler is client action. Inside the action update IsClicked = not IsClicked.
The above is for add/remove css class of a container. You can add css accordingly to make it work.
I think you can try, just give it a try first. Then if any issue can share your .oml then people can help.
Cheers,
Khuong