Hello. I am coding some HTML 5 drag and drop support where the user can drag images from a library to a textarea, and the necessary HTML to include the image will then be added. The addition of the html is done through a function that takes a <li> element as an argument and then does the rest.
The problem is that the drag and drop of any image results in the first <li> being sent to the function so clearly there's something wrong with my document traversing. Please take a look at the code below: The HTML can be seen here: http://hb.pastebin.com/m28f90fc8 And the relevant JavaScript is here: http://hb.pastebin.com/m1cf6fec1 If I drag 2.JPG.thumbnail.jpg to the textarea it should add the HTML for the 2.jpg but it doesn't, it adds 1.jpg - So "var asset = event.parentNode;" in the JS gets the wrong element. Any ideas how to fix it? Thanks