Rhaffaele Posted November 11, 2019 Share Posted November 11, 2019 Hello I'm preparing this drag and drop: http://www.mercuri-digital.com/Raffaele/ALAN9/test6.htm how can I identify the position of each target when the submit button is pressed? Link to comment Share on other sites More sharing options...
ZachSaucier Posted November 11, 2019 Share Posted November 11, 2019 Hey Rhaffaele, There's multiple ways to do this. One would be to keep track of the order as the user drags them around. Another way is to just detect the order at the end (when they're submitting). It'd probably be good to use an ID for the parent instead, but you could do something like this one liner: let answerOrder = []; document.querySelector(".col").querySelectorAll(".tile").forEach(answer => answerOrder.push(answer.id)); // Do what you need to with answerOrder 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now