I made a function that should add an item on the position I clicked inside a div. Now the problem with this function is, every time I click, it takes the x & y position
You need to change event.x to event.offsetX and event.y to event.offsetY
event.x
event.offsetX
event.y
event.offsetY
You didn't add the template definition but I'll add it just in case: