2013-07-18 27 views
0

我已经阅读了关于每个函数的很多文章(函数(){....以获得值html页面childs。但我不能这样做,我希望你能帮助我,我的一些糟糕的实验不工作。 。一个一个按钮,是不是在外面的行同时点击一个按钮,行值必须回到我。我需要TD的跨度值...如何通过单击外部按钮来获取所有td的跨度?

我不工作的样品:不工作:

 var id = $("#listsends").closest("tr").find(".label label-warning").text(); 

不工作:

 alert(id); 

    $("#listsends").find('.label label-warning').each(function() { 
     var textval = $('.label label-warning').text(); // this will be the text of each <td> 
     alert(textval); 
    }); 

     var t = $('.label label-warning'); 
     for (var i = 0; i < t.length; i++) 
      alert(t[i].text()); 

通过点击点击网页按钮(外部表,而不是内部)的,表中的TD,2S跨度值:

enter image description here

+0

你的html代码是什么? –

回答

1
$("#listsends").find('.label label-warning').each(function() { 
    var textval = $(this).text(); // as this is the scope of the element 
    alert(textval); 
}); 
相关问题