获取JQuery中的表ID

JN_*_*bie 1 jquery

我已经制作了三个带有id的html表是"table1","table2"和"table3".我能够得到第一张桌子的id.如何获取所有三个表的Id,然后使用JQuery在输出中显示这些Id.例如,表Id是:"table1",然后是"table2",然后是"table3"

Gau*_*rav 6

$('table').each(function(){
   alert(this.id);
});
Run Code Online (Sandbox Code Playgroud)