用jQuery取得table中某一个tr的index值
我们在table的row上定义事件,经常需要获得该行的行数。行数都从0开始计数。
?
var myRows = $('.table_gray tbody tr').click( function() { index = $(this).index() ; //利用jquery提供的取序号的方法 index1 = myRows.index(this);//TR的属性,其序号计算范围在tbody内,与上一方法结果一致 index2 = this.sectionRowIndex;//TR的属性,其序号计算范围包括所有的TR index3 = this.rowIndex; } });??
?