Mendix already gives dynamic ID to each element. But you cannot rely on it, as it keeps changing.
Mendix gives unique CSS name for each element that is created. You can also set the Name property in the common tab and use that along with some basic DOM navigation to find the element you need.
Check this document, although this is more for automation testing, reading this might answer your question.
Its better catch the div name. You can find this in container properties. You can use the JS method getElementByClassName to catch the div