I'm trying to access the following rectangularized item using the jQuery sortable plugin:
Currently my jQuery code looks like this (Note the question is about the even in the receive section):
$( "#listA, #listB" ).sortable({
connectWith: ".connected_sortable",
delay: 100,
receive: function(event, ui) {
alert(ui.item.text());
}
}).disableSelection();
HTML:
<ul id="listA" class="connected_sortable ui-sortable">
<li>
<div id="4">
Test Text
</div>
</li>
</ul>
How would I access that id using the alert? I tried alert(ui.item.context.childNodes.id)
and the alert returns an 'undefined'.
edits: added HTML and clarified the question abit.
Thank you!
Try this way:
alert(ui.item.context.childNodes[0].id)