我无法获得动态复选框的选中值。我究竟做错了什么?http://jsfiddle.net/hxfsB/17/
标记:
<html>
<body>
one<input type="checkbox" name='checkbox0' value="one_name" checked>
two<input type="checkbox" name='checkbox1' value="one_name1">
three<input type="checkbox" name='checkbox2' value="one_name2">
<input type="button" id="envoyer" value="Envoyer Reponse" />
</body>
</html>
Javascript:
$('#envoyer').click(function(e){
var myArray=new Array(4);
for ( var j = 0; j < 3; j++){
var check=$('input:checkbox[name=checkbox'+j+']').is(':checked');
if(check==true)
myArray[j]=$('input:checkbox[name=checkbox'+j+']').val();
}
alert('check '+" "+myArray[i]);
});