I have four divs with custom Attributes like:
<div marker="A">A1</div>
<div marker="A">A2</div>
<div marker="B">A3</div>
<div marker="B">A4</div>
Now I would like to use jquery to make each div drag- and drop-able.
Now when a user drags e.g. div A1 on div A2 (vice-verca would alos be possible), it shall compare the marker attribute and if the marker happens to be the same, I want an alert to inform the user about this.
How would I achieve that ? Can I use jquery-only or do I need a plugin for that ?
http://jqueryui.com/demos/draggable/
http://jqueryui.com/demos/droppable/
Updated with live demo!
Here, as you can see for yourself, using the draggable() and droppable() methods of jQuery UI, it is easy to achieve what you want… You can see the demo here:
http://vidasp.net/tinydemos/dragging-and-dropping.html