get ID attribute from dragging a sortable portlet
Hello,
I want to pull the ID tag from a div that has been moved using sortable portlets.
For example: Here are my divs in the body
<div id="container">
<div id="left" class="list" style="width: 49%; float:left;">
<div class="portlet" id="arrayorder1">
<div class="portlet-header">header one</div>
<div class="portlet-content" id="one">portlet content one</div>
</div>
<div class="portlet" id="arrayorder2">
<div class="portlet-header">header two</div>
<div class="portlet-content" id="two">portlet content two</div>
</div>
<div class="portlet" id="arrayorder3">
<div class="portlet-header">header content</div>
<div class="portlet-content" id="three">portlet content</div>
</div>
</div>
</div>
Here is the jquery for sortable. Line 18 and 19 are where I am trying to pull the ID of the dragged portlet-content div. The problem is that it is not returning the ID of the dragged portlet but instead the first child of the portlet div.
For example: I drag the bottom portlet into the middle. The JS alert will always return ID 1 from the top portlet-content div.
- <script type="text/javascript">
-
- $(function() {
- $(".list").sortable({
- connectWith: '.list',
- opacity: 0.6, cursor: 'move', update: function() {
- //alert (col);
- var order = $(this).sortable("serialize") + '&update=update';
- var name = $(this).children().attr("id");
- alert (name);
- $.post("updateList.php", {order:order}, function(theResponse){
- });
- }
- });
- });
-
- </script>