Get layout and cell ID with on click event

I need to be able to get Layout ID and Cell ID with on click event. It works in visual designer

There I can click on a cell and it’s automatically selected on the tree on the left. I need similar functionality.

May someone please provide a suggestion? I think writing a JS function that gets size and positioin of of all cells + mouse click X/Y coordinates and looks for a cell that was clicked is one way to do this but imo it’s very complex for this task as it would take days to code.

Is there a way to attach an “onClick” event to a cell? Or get cell id from “Event” object of window “click” listener:


…search for cell id in object “e” above?

Any suggestions are appreciated.

We can just suggest to do it with header double click … event.html