JQuery学习笔记(2)

1/用jquery获取某个td相对于table的索引值:

<script type="text/javascript">
$(document).ready(function(){
$("table td").bind("click",function(){
var index = $(this).parent().index();
alert(index);//表示所在行的索引。如果要的是列的索引,把parent()去掉
});
});
</script>

原文地址:https://www.cnblogs.com/kennyliu/p/3387765.html