This is my first time using jQuery (I’m familiar with Java) and I’ve followed some tutorials online to understand draggables/droppables and events etc.
The context is a simple interactive game where the user drags multiple items into categories.
What I want to know is, is it possible to dynamically create a number of objects, which can be draggable, the number of which determined from a php script before the main page loads? Like a constructor in Java terms?
Any help or direction would be greatly appreciated.
Thanks!
Yes, it’s very easy to create elements using jQuery. For example, the below code will create a new
divelement:To make this element draggable, you need to include jQueryUI in your page and then call
draggable()on it:Working example