首頁  >  文章  >  web前端  >  表单提交,只提交被复选框选中的行_html/css_WEB-ITnose

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

WBOY
WBOY原創
2016-06-24 11:57:211862瀏覽

  表单中有多条用遍历出来的数据,  仔面有个复选框,我怎么才能只提交我选中的那几行数据呢???


回复讨论(解决方案)

我发现,我一点提交他所有都会提交。但是复选框只有选中的为 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");		   	}		});    });

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn