그래서이 코드가테이블 행 복제, ID에 임의 번호 또는 순차 번호 추가
$('input.clone').live('click', function(){
//put jquery this context into a var
var $btn = $(this);
//use .closest() to navigate from the buttno to the closest row and clone it
var $clonedRow = $btn.closest('tr').clone();
//append the cloned row to end of the table
//clean ids if you need to
$clonedRow.find('*').andSelf().filter('[id]').each(function(){
//clear id or change to something else
this.id += '_clone';
});
//finally append new row to end of table
$btn.closest('tbody').append($clonedRow);
});
문제는, 각 행을 내가 복제 얻을 이름이 무엇이든 _clone 어떻게 쓸 것이라고 나는 함수를 실행할 때마다 임의 또는 더 이상 idealy 일련 번호를 선택합니다. "_clone"의 ID isntead에 추가하십시오.
의 행의 수를 사용할 수 있습니까? 그들은 row_x 수 있다면 – redsquare
글쎄, 내가 그들을 DB에서 당겨, 메신저 순차적 인 번호를 그들에게 이름을 PHP를 사용하려고 – mrpatg
또한 당신은 그것의 ID가 tr의 확신합니까? – redsquare