0
我已经找遍了这个,但没有太多的运气。如预期jQuery行更改和ID
$("span[id*=Section]").click(function(){
var row = $(this).parents("tr.MoveableRow:first");
if ($(this).is(".up_button")) {
row.insertBefore(row.prev());
section = this.id;
$("input[name='" + section + "']").val(row.closest("tr").prevAll("tr").length + 1);
} else {
row.insertAfter(row.next());
section = this.id;
$("input[name='" + section + "']").val(row.closest("tr").prevAll("tr").length + 1);
}
});
目前,上/下按钮点击时,在TR上移或下移:
所以给这个代码。 “输入[名称=”部分采用传入的跨度ID值并将新值分配给该TR内的隐藏字段。
这样做虽然给我重复的ID。因此,例如,我将第2行移动到第1行。旧行2的隐藏输入值变为1,但原始1的隐藏输入也为1.
所以我需要做的就是让旧的1,新的2.
你能在[JS小提琴](http://jsfiddle.net/)上重现这个吗? – 2012-03-16 22:20:29
您似乎不会更改其他行的值。我错过了什么吗? – 2012-03-16 22:21:53