0
我写了这样的事情来获得被点击jQuery中我的表内该行:jQuery的隐藏特定的表行的onclick点击事件
$("#datatable-responsive").delegate("tr", "click", function (e) {
console.log($(e.currentTarget).index() + 1);
});
这工作,但不是我想象的方式.. 。问题是我的表格中有超过1个动作按钮,我只需要触发特定类型的按钮,而不是所有的按钮。
所以HTML标记看起来像这样:
<tr>
<input type="text" class="titleInput" value="" />
<i class="fa fa-edit editTitle">
</tr>
所以在被点击的行我想隐藏的编辑按钮:
$(".editTitle").hide();
然后显示文本,使标题编辑:
$(".titleInput").show();
我怎么能达到这个效果,有人可以帮我吗?
编辑:
家伙如此总结它什么,我居然想在这里实现的是:
- Upon click on the ".editTitle", Id' like to hide this element and then show the textbox which is shown above the <i> tag itself, but only for the clicked row ...
你使用的是什么版本的jquery? – guradio
@guradio它在这里说:* jQuery JavaScript库v2.2.4 – User987
使用'.on()'。然后使用'$(this)'来引用点击元素 – guradio