<table id="table_vendor">
<thead>
<tr>
<th>vendor id</th>
</tr>
</thead>
<tbody>
<tr>
<td class="vendor_id"><a href="#" name="adwa" class="adwa">0001</a></td>
</tr>
<tr>
<td class="vendor_id"><a href="#" name="adwa" class="adwa">0002</a></td>
</tr>
<tr>
<td class="vendor_id"><a href="#" name="adwa" class="adwa">0003</a></td>
</tr>
<tr>
<td class="vendor_id"><a href="#" name="adwa" class="adwa">0004</a></td>
</tr>
</tbody>
</table>
和jquery
$("tr td a").click(function(){
var index = $(this).index();
alert(index);
});
我想要元素a的索引但是当我点击它时显示0
我很抱歉我的英语。