jQuery how to get html table id above button after clicked
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 thi开发者_如何学Cs button"?
$("button").click(function(){
var tblID = $(this).prev("table:first").attr("id");
});
精彩评论