hello - can't get the parent id of the list the item is dragged into. I can get the items' id easily enough and thought i could get the parent from that but can't seem to grab it!
<li id="tag_772" class="tag tagAssigned ui-draggable" >adventurous briefs</li>
is the li dragged in. Any help much appreciated!
$("li.tag").draggable({
connectToSortable: 'ul.assignedClass',
helper: 'clone',
stop: function(event, ui) {
projectTags('add',$(this))
}
});
function projectTags(fnc, tag){
var tagID = $(tag).attr("id")
var parentID = $("#"+tagID).closest('ul').attr("id"); /// closest, parent & parents doesn't work?
$("#fdbk").prepend("<li>fnc:"+fnc+", tag:"+tagID+" < "+ $("#"+tagID).parents("ul:first").attr("id")+"</li>");
}
html;
<ul id="tags_978" class="assignedClass ui-sortable">
<li id="existingTag_1029" class="tagAssigned">space </li>
<li id="existingTag_1030" class="tagAssigned">light </li>
<li id="existingTag_1031" class="tagAssigned">continuous landscape </li>
<li id="existingTag_1032" class="tagAssigned">structural glass </li>
<li id="tag_772" class="tag tagAssigned ui-draggable" >adventurous briefs</li>
</ul>