欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

表单提交,只提交被复选框选中的行_html/css_WEB-ITnose

程序员文章站 2022-04-25 08:50:31
...
表单中有多条用遍历出来的数据, 仔面有个复选框,我怎么才能只提交我选中的那几行数据呢???


回复讨论(解决方案)

我发现,我一点提交他所有都会提交。但是复选框只有选中的为 on ,没有选中的就没有

提交事件里面把没有选中的行的name去掉

谢谢提醒!!!!解决了
这是方法代码

 $("#jiesuan").click(function(){    	alert("结算");    	  //复选框的name='od'      	$("input[name='od']").each(function(){		    if($(this).attr("checked")== 'checked'){		    	//是选中		    }else{		    	//       td       tr   		        $(this).parent().parent().find("input").removeAttr("name");		   	}		});    });