2013年3月11日星期一
jquery-table management2
$('td').click(function(){
var colIndex = $(this).parent().children().index($(this));
var rowIndex = $(this).parent().parent().children().index($(this).parent());
alert('Row: ' + rowIndex + ', Column: ' + colIndex);
});
Javascript-table management1
to alert the text value of each td
Copy code
- $('table tr td').each(function(){
- var texto = $(this).text();
- });
if you want the value of the first row second column, otherwise known as row 1 cell 2 or position(1,2),
Copy code
- var texto = $('table tr:nth-child(1) td:nth-child(2)').text()
订阅:
博文 (Atom)