我正在使用克隆将一行动态插入到带有 JQuery 的表中。
$('#Clone').click(function() {
//put jquery this context into a var
var $btn = $(this).parent();
//use .closest() to navigate from the buttno to the closest row and clone it
//use clone(true) to pass events to cloned item
var $clonedRow = $btn.closest('tr').clone(true).insertAfter($btn);
});
最终用户将控制新行的插入。我需要将新行数限制为 5。有没有办法使用 cookie 或其他方法(数组)来做到这一点。我可以有多个具有自己唯一 ID 的表,因此它需要与页面上的多个表一起使用。
希望你能帮忙。