开发者

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");
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜