I have the following repeating pattern of tables and buttons
----------------------
table 1 .inventory class
----------------------
[button 1 .add-row]
----------------------
table 2 .inventory class
----------------------
[button 2 .add-row]
----------------------
table 3 .inventory class
----------------------
[button 3 .add-row]
now when i click button 1,2,3 i want to traverse to table 1,2,3 respectively (the previous table) and display an extra row o nthe table(already created, just hidden), I tried this but all the buttons only effect the first table first and once all those rows are displayed it then starts displaying on the next table etc etc, i know the answer is probably obvious.. heres my code:
$(document).ready(function(){
$('.additional-item-row').hide();
$('.add-item').click(function(){
$(this).prevAll(".inventory .additional-item-row:hidden:first").show();
});
});