开发者

First child from XML using jQuery

开发者 https://www.devze.com 2023-01-07 12:36 出处:网络
<Row ss:AutoFitHeight=\"0\"> <Cell> <Data ss:Type=\"Number\">1</Data> </Cell>
<Row ss:AutoFitHeight="0">      
    <Cell>
       <Data ss:Type="Number">1</Data> 
    </Cell>
    <Cell>
       <Data ss:Type="Number">2</Data> 
    </Cell>
    <Cell>
       <Data ss:Type="Number">3</Data> 
    </Cell>   
</开发者_如何学JAVARow>
<Row ss:AutoFitHeight="0">      
    <Cell>
       <Data ss:Type="Number">1</Data> 
    </Cell>
    <Cell>
       <Data ss:Type="Number">2</Data> 
    </Cell>
    <Cell>
       <Data ss:Type="Number">3</Data> 
    </Cell>   
</Row>
<Row ss:AutoFitHeight="0">      
    <Cell>
       <Data ss:Type="Number">1</Data> 
    </Cell>
    <Cell>
       <Data ss:Type="Number">2</Data> 
    </Cell>
    <Cell>
       <Data ss:Type="Number">3</Data> 
    </Cell>   
</Row>

  $(xml).find("Data").each(function(index){
   //if (index%2!=0)
   {
    data.push($(this).eq(1).text().toLowerCase().trim());
   }
            });

Looking for jQuery traversal for first child, I want first node of data for each row, o/p 111


Try:

$('Row Cell Data:nth-child(1)').each(function(){
  alert($(this).text());
});
0

精彩评论

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