How to get current row of input control like textbox within html table
I am getting all checkboxes that are in an html table using this code and I need to find the current row in the table from the current checkbox.
var checkboxes = $("form :checkbox")开发者_如何学C;
for (i = 0; i <= checkboxes.length; i++) {
var checkbox = checkboxes[i];
///need to get current row in html table here
}
var checkboxes = $("form :checkbox");
for (i = 0; i <= checkboxes.length; i++) {
var checkbox = checkboxes[i];
var rowIndex = $(checkbox).closest('tr')[0].rowIndex;
}
should do it
精彩评论