Jquery 如何 cellIndex

出自Guoshuang Wiki

跳转到: 导航, 搜索

用 attr("cellIndex") 即可。

//选中列效果

$("#showTable th").click(function(){

//返回在 tbody 中的序数 而不是 cellIndex 的每行
thIndex=$("#showTable th").index(this)+1;
$("#showTable tbody td").css("background","transparent");
$("#showTable tbody td:nth-child("+thIndex+")").css("background","#ccc");
})
个人工具
留言