jq 遍历 元素

$("#spec").find("div.gods-spe").each(function(i,n){
		var child = $(this).children();
		//var name = child.eq(0).text();
		var dics = child.eq(1).find("input").eq(0).val();
		var money = child.eq(1).find("input").eq(1).val();
		var stock = child.eq(1).find("input").eq(2).val();
		var file = child.eq(1).find("input").eq(3).attr("id");
		if(Validate.isEmpty(dics)){
			$("#mobody").html("商品规格描述不能为空!");
			$("#myModal").modal('show');
			return;
		}
		if(Validate.isEmpty(money)){
			$("#mobody").html("商品售价不能为空!");
			$("#myModal").modal('show');
			return;
		}
		if(Validate.isEmpty(stock)){
			$("#mobody").html("商品库存不能为空!");
			$("#myModal").modal('show');
			return;
		}
		if($("#"+file).val()==""){
			$("#mobody").html("请上传规格图片!");
			$("#myModal").modal('show');
			return;
		}
		myArray.push({"dics":dics,"money":money,"stock":stock});
		filearray.push(file);
	})

  

原文地址:https://www.cnblogs.com/xdcr/p/9754502.html