慕容708150
/** * 好好看下jQuery文档吧 * @see https://api.jquery.com/each/#each-function */var tdVals = trs.parents('tr').children('td');var inputVals = $('.con-detail input[type=text]');$(tdVals).each(function(index, td){ // td是DOM, index是索引 if(!(index <= 1)){ /** * inputVals 也是一个DOM合集,你如果想插入值你得使用下列方法: * 1 > inputVals[index].value = "text"; * 2 > $(inputVals[index]).val("text"); * @see http://api.jquery.com/val/ * @see https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input */ inputVals[i-2].value = $(td).text(); // $(DOM).text() 才对。 }});