的前一个实例我已经表和按钮遍历DOM找到
----------------------
table 1 .inventory class
----------------------
[button 1 .add-row]
----------------------
table 2 .inventory class
----------------------
[button 2 .add-row]
----------------------
table 3 .inventory class
----------------------
[button 3 .add-row]
现在
以下重复模式当我点击按钮1,2,3我想遍历表1,2,3 (前面的表格),并在表格中显示一个额外的行(已经创建,只是隐藏),我试过但所有的按钮只影响第一个表格,一旦显示所有这些行,然后开始显示在下一个表格上等我知道答案可能很明显..继承人我的代码:
$(document).ready(function(){
$('.additional-item-row').hide();
$('.add-item').click(function(){
$(this).prevAll(".inventory .additional-item-row:hidden:first").show();
});
});