繁体   English   中英

从行 id 和表 id 中获取行索引

[英]Get row index from row id and table id

我试图在点击超链接时获取一行的索引号 我也从这个标签传递了一些其他数据

<a href="javascript:void(0);" onclick="EditDoctorRow(' + RowCountDoctorVisit + ');">
    <i class="fa fa-edit"></i>
</a>

我试过

$('table#DoctorVisit tr#' + RowCount).index()
$('table#DoctorVisit tr#' + RowCount).closest.index()

但两者都不起作用

这将为您提供所选元素的最近行 ID。

var row_id = $(this).closest('tr').index()

回复您的评论(再次): http : //jsfiddle.net/vcLvxycv/4/

这与行 ID 无关,将按要求返回索引!


好的! 最后编辑我想我知道你的意思。 在输入框中输入行 ID 之一,它将返回该行的索引

http://jsfiddle.net/vcLvxycv/7/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM