searching for a js-solution to click and to create/place an image at this point. If I move the mouse to a different point, another click should place a second image, and so on.
Asked
Active
Viewed 50 times
0
-
Welcome to SO. Please read [How to ask a good question](https://stackoverflow.com/help/how-to-ask). – Mitya Jan 06 '19 at 12:29
-
And please also read how to create a [mcve] because asking for plugin recommendation is strictly off-topic so you need to show us what you tried and where you stuck – Alon Eitan Jan 06 '19 at 12:31
-
sorry, I already did, this is my second attempt with this problem. what did I wrong? or are there errors with the language? I am not a native speaker but used a translating tool for that, sorry? – Matthias Ballmann Jan 06 '19 at 12:33
-
It's fine, but the idea of showing your attempt is to allow others to post an answer that is based on your current code, and also, if possible, that it will be helpful for other users with similar issues in future – Alon Eitan Jan 06 '19 at 12:38
-
plugin recommendation is off-topic? oh, there was not mention about it in "how to ask". thank you for that important information. I just need a starting point because neither readymade plugins now the jquery docs could bring me on that path. – Matthias Ballmann Jan 06 '19 at 12:39
-
Yeah, it's mentioned [here](https://stackoverflow.com/help/on-topic) :) _"Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam"_ (Section 4) – Alon Eitan Jan 06 '19 at 12:40
-
@AlonEitan: Oh, excuse me – I didn't understand the content or related it to jquery/plugins... also because I've seen many such questions/answers here in the past. Ok, I understood how it works now – Thank you :-) – Matthias Ballmann Jan 06 '19 at 12:44
-
@MatthiasBallmann NP, there are similar questions about it - [This](https://stackoverflow.com/questions/9370503/html5-canvas-add-image-on-mouse-click-at-mouse-coordinates), and [this](https://stackoverflow.com/questions/9880279/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element). Hope it will help. Good luck! :) – Alon Eitan Jan 06 '19 at 12:52
1 Answers
2
One way is something like this:
First get the position from the click: javascript get x and y coordinates on mouse click
Add an eventlistner to click that places an absolute positioned image with the coordinates gained above. https://www.w3schools.com/js/js_htmldom_eventlistener.asp

Brainmaniac
- 2,203
- 4
- 29
- 53
-
thanks for that starting point! I already found that x/y-mouse-click-post prior to asking but had problems going further from there. I’ll try your attempt! – Matthias Ballmann Jan 06 '19 at 12:47