Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
47
rated 0 times [  51] [ 4]  / answers: 1 / hits: 55905  / 13 Years ago, thu, april 28, 2011, 12:00:00

I have code in the following style :



<tr id=201461>
<td id=0A style=cursor:pointer onClick = ProcessTextBoxClick() value=Feb 23 2008>Feb 23 2008</td>
<td id=0B style=cursor:pointer onClick = ProcessTextBoxClick() value=Feb 25 2008>Feb 25 2008</td>
<td id=0C style=cursor:pointer onClick = ProcessTextBoxClick() value=Feb 28 2008>Feb 28 2008</td></tr><tr id=201460>
<td id=1A style=cursor:pointer onClick = ProcessTextBoxClick() value=47>47</td></tr>


I have some JQuery where I am getting the id of each row, and now I want to get each value in each td for each row. How do I do this?



 var tbl = document.getElementById(tbl-1);

var numRows = tbl.rows.length;

for (var i = 1; i < numRows; i++) {

var ID = tbl.rows[i].id;

More From » jquery

 Answers
79

in jQuery:



$(table#tbl-1 tr).each(function( i ) {
$(td, this).each(function( j ) {
console.log(.concat(row: , i, , col: , j, , value: , $(this).text()));
});
});


You can check it in work here: http://jsfiddle.net/3kWNh/


[#92506] Wednesday, April 27, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
melindab

Total Points: 511
Total Questions: 109
Total Answers: 106

Location: San Marino
Member since Thu, Jun 25, 2020
4 Years ago
;