views:

128

answers:

1

i have an html table followed by a button that says "Add Row" below it.

WHen i click on the button, i would like to add a new row onto the html table but first i need to get the html table id above.

is there anyway in jquery to say "Give me the id of the html table right before this button">

+4  A: 
$("button").click(function(){
  var tblID = $(this).prev("table:first").attr("id");
});
Jonathan Sampson