I'm new to web development, and even newer to jQuery, so if this is a dumb idea, please let me know.
What I want to do is to simplify the drag/drop stuff to allow me to add a few attributes to the drop recipients to allow different types of draggables onto it.
So, let's say I have 3 lists I can drag from. A, B and C
Next, I have 2 places I can drop to: M and N
What I would like to do is to define M in a way that would let me drop A and C onto it using html attributes:
<div id="1" class="droppable" drop-targets=".A,.C">
<div id="2" class="droppable" drop-targets=".B">
This is a simplified concept from what the real situation is-so, it doesn't seem as necessary with this small example. In reality, depending on what you are looking at, there might be quite a few different types of draggables and they shouldn't be allowed to go just anywhere.
What I was trying to do was something like:
$(function() {
$(.draggable").draggable();
$(.droppable").droppable({
accept: $(this).attr("drop-targets"),
drop: function() { .... }
});
});
But, that just dies silently. Is there any way to do this?