Using sortContent plugin ,everything will be easy,clean and ready for reuse :
$('ul').sortContent({helper:myhelper});
Known that :
myhelper=function(e){
return $('a',$(e)).attr('href');
}
DEMO
If you want to discover other options , visit Plugin HOMEPAGE