Javascript 如何在id=';测试';并获取表中每一行的ID?
如何使用id='test'遍历表,并使用JQuery获取表中每一行的id?Javascript 如何在id=';测试';并获取表中每一行的ID?,javascript,jquery,Javascript,Jquery,如何使用id='test'遍历表,并使用JQuery获取表中每一行的id? 我需要收集阵列中的ID。我想您正在寻找: 我想你在寻找: 使用以下代码: $("#test tr").each(function(){ var row_id=$(this).attr("id"); // Now do something with the row_id variable. }); Ad@m使用以下代码: $("#test tr").each(function(){ var ro
我需要收集阵列中的ID。我想您正在寻找:
我想你在寻找: 使用以下代码:
$("#test tr").each(function(){
var row_id=$(this).attr("id");
// Now do something with the row_id variable.
});
Ad@m使用以下代码:
$("#test tr").each(function(){
var row_id=$(this).attr("id");
// Now do something with the row_id variable.
});
Ad@m为什么这次投票被否决?我认为这是一个合法的问题。为什么会被否决?我认为这是一个合法的问题。我认为这是做这件事的最合适的方法
$('table#test tr').each(function() {
alert($(this).attr('id')); //here you can push these id's into an array
});
$("#test tr").each(function(){
var row_id=$(this).attr("id");
// Now do something with the row_id variable.
});
var TrIds = [];
$('#TableId tr').each(function() {
TrIds[] = $(this).id();
});