怎样获取row中第4列的数据,并且text为9的数据,分开会,两个合并不会??
第四列 return $row.find("td").index($elem) =3;
值为9 return $row.find("td").text() ==9;
请问两个合并怎么弄
[解决办法]
http://api.jquery.com/
[解决办法]
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#grid tr").each(function(){
//alert($(this).children('td').eq(3).text());
if($(this).children('td').eq(3).text()==9){
$(this).children('td').eq(3).css('background-color', 'red') .css('font-weight','bold');
}
});
})
</script>
<table id="grid" border="1">
<tr>
<td>61</td>
<td>1</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>21</td>
<td>2</td>
<td>9</td>
</tr>
<tr>
<td>65</td>
<td>2</td>
<td>43</td>
<td>2</td>
</tr>
<tr>
<td>65</td>
<td>2</td>
<td>43</td>
<td>9</td>
</tr>
</table>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#grid tr").each(function(){
if($(this).find('td:eq(3)').text()==9){
$(this).find('td:eq(3)').css('background-color', 'red') .css('font-weight','bold');
}
});
})
</script>