bonjour

je cherche a gerer deux series de checkbox associees a des graphes

pour le code html

Code html : 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
<FORM action="">
<input type="checkbox"  value="11" id="check1" checked="checked" name= "courb1"><label for="mycheckbox">{{ ref }}</label>
<input type="checkbox"  value="12" id="check2" checked="checked"  name= "courb1"><label for="myCheckbox">{{ laref2 }}</label>
<input type="checkbox"  value="13" id="check1" checked="checked"  name= "courb1"><label for="mycheckbox">{{ laref3 }}</label>
<input type="checkbox"  value="14" id="check2" checked="checked"  name= "courb1"><label for="myCheckbox">{{ laref4 }}</label> 
</FORM> 
 
<div id="matfit"></div>
 
</br>
 
<FORM action="">
<input type="checkbox"  value="21" id="check1" checked="checked" name= "courb2"><label for="mycheckbox">{{ laref10 }}</label>
<input type="checkbox"  value="22" id="check2" checked="checked"  name= "courb2"><label for="myCheckbox">{{ laref20 }}</label>
<input type="checkbox"  value="23" id="check1" checked="checked"  name= "courb2"><label for="mycheckbox">{{ laref30 }}</label>
<input type="checkbox"  value="24" id="check2" checked="checked"  name= "courb2"><label for="myCheckbox">{{ laref40 }}</label> 
</FORM> 
 
<div id="matfit2"></div>

pour le script j'ai

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
$("input[type='checkbox']").change(function(e) {
 var output = '';
   var output2 = '';
$("input[name=courb2]").each(function() {
            var check = this.checked;
          output2 += $(this).val() + ",";
});
 
$("input[name=courb1]").each(function() {
      var check = this.checked;
      output += $(this).val() + ",";
});
ceci ne marche pas ?? alors que si j'ecris

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
$('input[type="checkbox"]:checked').each(function(index) {
    output += $(this).val() + ",";
});
ca marche sauf qu'on traite l'ensemble des checkbox et non chaque serie

pourquoi $("input[name=courb1]").each(function() { marche pas