First child from XML using jQuery
<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());
});
精彩评论