Hello. I want to change a nested Navigation by drag and drop and i find a nice plugin. Now i want to store the changes in the database, but unfortually I can't read out the id of the parent element. The second thing what I need is the new position of the dragged li element in the list
<script type="text/javascript" src="includes/jquery/jquery.js"></script>
<script type="text/javascript" src="includes/jquery/interface.js"></script>
<script type="text/javascript" src="includes/jquery/inestedsortable-1.0.pack.js"></script>
<script type="text/javascript">
jQuery( function($) {
$('#Hnav, #Nnav').NestedSortable(
{
accept: 'sort',
noNestingClass: "no-children",
helperclass: 'helper',
autoScroll: true,
onChange: function(serialized) {
onStop : function(){
$('#output').html($(this).id); // works fine
$('#output').html($(this).parent().parent().att('id')); // fail
$('#output').html(this.closest('li').att('id')); // fail
},
nestingPxSpace : '0'
}
);
});
</script>
html
<div id="sitemap">
<ul id="Hnav">
<li id="n1"><a href="contentsite.php?cont=1">Home</a></li>
<li id="n2" class="sort"><a href="contentsite.php?cont=2">Choir</a>
<ul class="level2">
<li id="n4" class="sort"><a href="contentsite.php?cont=3">lkff</a></li>
<li id="n6" class="sort"><a href="contentsite.php?cont=5">changethis</a></li>
<li id="n5" class="sort"><a href="contentsite.php?cont=4">History</a></li>
</ul>
</li>
...
Any idea? Thank you.
Lara