Итак, у меня есть этот код
$('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
Как бы я написал это так, чтобы каждый раз, когда я запускаю функцию, она выбирает случайное или более идеальное последовательное число для добавления к идентификатору вместо _clone