小编use*_*239的帖子

确定用户单击的列/行

使用JQuery,我需要知道用户是否单击了链接或第三列,并且需要在第一列中获取变量的值.我该怎么做呢?

我的HTML:

<div id="test">
<table id="tablex" cellpadding="0" cellspacing="0" border="0" class="display">
    <thead>
        <tr>
            <th>Cod</th>
            <th>Name completo</th>
            <th>&nbsp;</th>
        </tr>
    </thead>
    <tbody>
         <tr>
             <td>1</td>
             <td>John Foster 1</td>
             <td><img entity_id="1" class="image-selector" src='imagens/grid_cancel.png' title=''  /></td>
         </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

我的jQuery:

$("#tablex tbody").on("click", "td", function(event){
   alert($(this).text());
});
Run Code Online (Sandbox Code Playgroud)

jquery jquery-plugins datatables

4
推荐指数
1
解决办法
6426
查看次数

标签 统计

datatables ×1

jquery ×1

jquery-plugins ×1