Skip to content
Advertisement

Dynamically append DOM where mouse clicked

I have a page where I want to dynamically add a pin/marker wherever I clicked.

I’ve tried

JavaScript
JavaScript
JavaScript

I couldn’t get it to work.

enter image description here

Advertisement

Answer

Create the element, apply the styles, then append.

Also, make sure the element has a higher z-index:

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement