Best practices for manipulating the DOM

If you do not want to use LiveView, you can use the same pattern that you were using with Rails. I see nothing wrong with it in principles.

That said, you do not need to convert the whole app to LiveView in order to use it in one specific place.