Using multiple layouts I lose IDs and this does not have to happen because errors are generated in JS functions.
It is imperative to find a solution to keep them in all layouts. Work with the suggested classes is complicated.
The height of the templates should not be defined in pixels, but it may be dynamic based on dynamic content.
All the best!
though this is really not that much effort: