Bonjour tout le monde,
Comme indiqué dans le titre de ce post, je souhaite sérializer toutes les sous-listes présentes sur ma page.
Actuellement, je n'arrive à sérializer que la liste principale, pas les sous-listes.

Je vous montre le code. Merci d'avance pour votre aide !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
<html>
<head>
<script type="text/javascript" src="jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript">
  function enreg_position()
  {
	serial = $(".list").sortable("serialize");
	$("#position").val(serial);
	alert(serial);
  }
  $(function() {
    $("ul.list").sortable({
		update: function(event, ui) { 
			enreg_position(); 
		}	
    });
  $("ul.list").selectable();
  $("ul.list").disableSelection();
 
  	$('ul.list').bind('mousedown', function(e) {
  		e.stopPropagation();
	});
 
});
</script>
</head>
<body>
  <ul class="list">
    <li id="chapitre_1">Chapitre 1</li>
    <li id="chapitre_2">Chapitre 2
    	<ul class="list">
    		<li id="chapitre_2_1">Chapitre 2.1</li>
        	<li id="chapitre_2_2">Chapitre 2.2</li>
      	</ul>
    </li>
    <li id="chapitre_3">Chapitre 3</li>
    <li id="chapitre_4">Chapitre 4</li>
    <li id="chapitre_5">Chapitre 5
    	<ul class="list">
            <li id="chapitre_5_1">Chapitre 5.1</li>
            <li id="chapitre_5_2">Chapitre 5.2</li>
            <li id="chapitre_5_3">Chapitre 5.3</li>
            <li id="chapitre_5_4">Chapitre 5.4</li>
      	</ul>
 
    </li>
    <li id="chapitre_6">Chapter 6</li>    
  </ul>
</body>
</html>