2014-02-19 69 views
-3

我想选择表格第二行的所有行,我该怎么做? 我试过下面的代码,但它在Siebel OpenUI平台上不适合我。从表格的第二行中选择所有行?

$('#s_1_l').find("tr").each(function() {      
    if($(this).not(":first-child")){ 
     alert($(this).find("td:eq(2)").text());    
    } 
}); 

在此先感谢..

+5

咦?第二行的所有行?你是指所有专栏? – BenM

+1

你是否从第二行**开始** **单元**?你不能连续排成一行... – Joeytje50

+0

@ Joeytje50不好与*那*态度=) – MonkeyZeus

回答

0

我的理解是,你要跳过第一<tr>和选择列#2和之后。

你可以做到这一点与nextAll()方法:

CSS

tr{ 
    padding:10px; 
    background-color:black; 
} 

jQuery的

// find the first <tr> in the table 
// select all the following <tr>'s and make them yellow 
$('table').find('tr').eq(0).nextAll('tr').css('background-color','yellow'); 

HTML

<table> 
    <tr><td>1</td></tr> <!-- not selected --> 
    <tr><td>2</td></tr> <!-- selected --> 
    <tr><td>3</td></tr> <!-- selected --> 
    <tr><td>4</td></tr> <!-- selected --> 
    <tr><td>5</td></tr> <!-- selected --> 
    <tr><td>6</td></tr> <!-- selected --> 
    <tr><td>7</td></tr> <!-- selected --> 
</table> 
+0

非常感谢@ MonkeyZeus..IT正常工作。 – Chiranjit

+0

欢迎您,如果它正确回答您的问题,请接受我的答案为正确答案。 – MonkeyZeus

0

试试这个,我的好朋友:-)

$(document).ready(function(){ 
    console.log($('table[id^=#s_1_l] tr').eq(1)); 
}); 
相关问题