Click here to Skip to main content
15,905,682 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, all good morning.

I have a table and in that table I have 3 rows and 6 columns.And when I will click on check box of 2nd row that time I need 3rd column value.

How, I will get that value using javascript or jquery?

Can anybody will help please?

Regards,
Apali
Posted

Follow this[Modify according to your needs]:
C#
var temp=document.getElementById("yourtable") 
// Loop through all rows and columns of the table and popup alert with the value content of each cell. 
for ( var i = 0; i<temp.rows.length;i++){
  var row = temp.rows.item(i); 
  for ( var j = 0; j<row.cells.length;j++){
    var col = row.cells.item(j);
    alert(col.firstChild.innerText); //This will give you 'TEXT'
  } 
}


Regards.. :laugh:
 
Share this answer
 
v2
Try below code to get values using Jquery
JavaScript
$(this).closest('tr').find('td:nth-child(4)').html()


Check sample on fiddle http://jsfiddle.net/9RyHv/[^]
 
Share this answer
 
Comments
Apali 10-Jul-13 2:56am    
thanks to all now i got my answer...thanx again

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