I can’t seem to find any tutorial on Google regarding this, but I’ve seen people do it in some websites.
I’m trying to create a form where my users can drag and drop products into their shopping list but I have no idea how to get jQuery UI’s draggable to set the values for that specific form field once it has been dropped.
There is a drop event that is fired when you drop something:
So all you need to do is listen for the drop event and update something (such as an
<input type="hidden">) in the form as needed. You could use a data attribute on the draggable to identify the product elements:and then do something like this to update your form:
Demo: http://jsfiddle.net/ambiguous/6Cy97/