簡體   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