Click here to Skip to main content
15,920,468 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi i m having the below html. Now i m trying to add the css('display','none') to the third
for each row of the table id 'customerIdtest' using jquery im unable to reach my task.. Your help wil highly appreciated.
<div class='lbd' id = 'customerId'>

<table>
 <tbody>
	<tr class = 'listrow'>
	</tr>
	<tr class = 'listrow'>
	</tr>
	<tr class = 'listrow'>	
	</tr>
</tbody>	
</table>

<div id='customerId2'>
</div>

<table id = 'customerIdtest'>
	<tbody>	
	<tr class = 'listrow'>

	   <td ></td>
	   <td ></td>
	   <td ></td>

	</tr>

	<tr class ='listrow'>

	   <td ></td>
	   <td ></td>	
	   <td ></td>
	</tr>

	</tbody>

</table>

<div id = customerId3>
</div>

</div>

<script>
 $('#customerIdtest').children('.listrow').each(function(index,value){
	$(value).children('td')[2].className='DN';
});
</script>
Posted

1 solution

Do it like this -
HTML
<table id="customerIdtest">
	<tbody>	
	<tr class="listrow">
 
	   <td></td>
	   <td></td>
	   <td class="toHide"></td>
 
	</tr>
 
	<tr class="listrow">
 
	   <td></td>
	   <td></td>	
	   <td class="toHide"></td>
	</tr>
 
	</tbody>
 
</table>

and script as -
JavaScript
<script type="text/javascript">
$(document).ready(function(){
  $('.listrow .toHide').hide();
});
</script>

Hope this will help :)


[Mark it as answer if it solves your problem]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900