I am having a problem getting ui.draggable to work. I am hoping to be able to return its ID. All it returns is undefined, which I do not understand.
Here is my droppable call....
$( ".currqcontainer" ).droppable({
accept: ".currqwrapper",
drop: function (ui, event) {
alert("dropped");
var testid = $(ui.draggable).attr('id');
alert(testid);
}
});
Here is my draggable initialization...
$( ".currqwrapper" ).draggable({ revert: "invalid" });
I am creating the currqwrapper instances with this script.
var $div = $("<div/>", {id: objectID, class: "currqwrapper", text: question});
$("#currQ" + (i+1)).append($div);
If any of you could tell me why I am not correctly able to read the ID that would be great. Obviously I can provide anything else you need as well!
HERE IS MY CONSOLE.LOG(UI)It has the ID I need in there #ZiuFEYAcpP but I am not sure how to call it out? I notice it is in the toElement...
toElement: div#ZiuFEYAcpP.currqwrapper.ui-draggable.ui-draggable-handle
accessKey: ""
align: ""
attributes: NamedNodeMap
0: id
baseURI: null
childNodes: NodeList[1]
firstChild: text
baseURI: null
childNodes: NodeList[0]
data: "ZiuFEYAcpP"
firstChild: null
lastChild: null
length: 10
localName: null
namespaceURI: null
nextElementSibling: null
nextSibling: null
nodeName: "#text"
nodeType: 3
nodeValue: "ZiuFEYAcpP"