Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 未保存动态添加的复选框_Jquery_Html_Checkbox - Fatal编程技术网

Jquery 未保存动态添加的复选框

Jquery 未保存动态添加的复选框,jquery,html,checkbox,Jquery,Html,Checkbox,我试图动态添加行。似乎除了复选框之外,所有数据都保存在服务器端 <td rowspan="2" class="text-center"> <input name="F_02_0080_2" id="F_02_0080_2" class="" type="checkbox"> </td> <td rowspan="2" class="te

我试图动态添加行。似乎除了复选框之外,所有数据都保存在服务器端

            <td rowspan="2" class="text-center">
              <input name="F_02_0080_2" id="F_02_0080_2" class="" type="checkbox">          
            </td>
            <td rowspan="2" class="text-center">
              <input name="F_02_0090_2" id="F_02_0090_2" class="" type="checkbox">
            </td>

根据@Barmar的评论,我应该做以下更改:

   set_blank_row:function(row){
      $(row).children().find("input[type='text'], textarea,input[type='checkbox']").each(function(){
      $(this).val("");
      if($(this).is(':checkbox')){
        $(this).removeAttr("checked");
            var clicked = $(this).attr('checked');
            if(clicked){
                $(this).attr('value', 'on');
            }else{
                $(this).removeAttr('value');
            }
       }

     });
}

@dcc的可能副本:但是我不能使用ajax来保存,尤其是对于这个表单。如果我使用它,有很多事情需要手动完成。添加的复选框是否在表单中?提交表单时,静态元素和动态元素之间没有区别,它只使用DOM中当前的任何元素。似乎您正在以相同的
名称传递所有复选框。。您必须以单个名称或数组形式传递它们。
F_02_0090_2[]
@PhilipJensBramsted它们的名称如何相同<代码>0080
!=<代码>0090。
   set_blank_row:function(row){
      $(row).children().find("input[type='text'], textarea,input[type='checkbox']").each(function(){
      $(this).val("");
      if($(this).is(':checkbox')){
        $(this).removeAttr("checked");
            var clicked = $(this).attr('checked');
            if(clicked){
                $(this).attr('value', 'on');
            }else{
                $(this).removeAttr('value');
            }
       }

     });
}