[jQuery] Sortable list - even when list is changed

2010-02-21 Thread rafald
Hello,

I just started to user jquery. Its very good , though as the beginner
I have some issues ;-)

I have sortable llisty build like this:
ul id=elements
li id=li1Item 1/li
.
/ul

in functions.js I have this:

$(function(){
$(#elements).sortable();
$(#elements).disableSelection();
});

This make the whole list perfectly sortable and works fine.

My problem is with events I would like to add.
I have read that following should work:

$('#elements').sortable({
   update: function(event, ui) { alert('update') }
});

Since I am using list in round corner div, my whole code looks like
this:

$(document).ready(function(){
$('#elements').sortable({
   update: function(event, ui) { alert('update') }
});
$(div.roundbox) .wrap('div class=dialog'+
'div class=bd'+
'div class=c'+
'div class=s'+
'/div'+
'/div'+
'/div'+
'/div');
$('div.dialog').prepend('div class=hd'+
'div class=c/div'+
'/div')
.append('div class=ft'+
'div class=c/div'+
'/div');
});

but it does not work!
I need to execute a function each time when order of item on the list
will change.
I my example I just wanted to test function, and therefore I added
alert.
Could anybody advise me what is wrong here?

regards
Rafal


Re: [jQuery] Sortable list - even when list is changed

2010-02-21 Thread Nathan Klatt
Hi Rafal,

In what way does it not work? I transcribed your code into jsbin and
it seems to be fine, though I don't have any roundbox styling being
applied:

http://jsbin.com/oququ3/edit

Nathan