I have the foll开发者_开发知识库owing:
$('tbody').delegate('td','click',function() {
log($(this).index()); // Column
});
Q: How do I determine the row?
Use the .parent()
method.
$('tbody').delegate('td','click',function() {
$(this).parent(); // tr
});
Or you can use:
.closest()
Traverse up the tree, starting at current element..parents()
Traverse up the tree starting with parent element.
parent()
is maybe what you are looking for. Like this:
$(this).parent()
精彩评论