我正在尝试实现一种功能,当点击链接时,相应的锚表行被有效地消隐,链接被禁用。
这可以使用jQuery吗?
其中一个表行的示例是: -
<tr class="bcell">
<th scope="row"><a title="bla" class="addlink" id="a_205">Adrian Apple</a></th>
<td>name</td>
<td class="bcell">
<span>0 / 0</span>
</td>
<td>jt 76 99 44 D</td>
<td>12122121212121</td>
</tr>
因此,如果单击锚点,该行将被消隐。
答案 0 :(得分:0)
你可以尝试
.show() hide();
或
使用.html() or .text()
替换内容本身
或
addClass and removeClass or add()
用于添加css。
你想要什么。
答案 1 :(得分:0)
这段代码将自我解释:
$(".addlink").click(function(){
[..]
//$(this) refers to the clicked anchor
//With .parents("tr:first") you retrieve
//the desired anchor row
var AnchorRow = $(this).parents("tr:first");
// Now you can do wathever you want: You have the anchor row (It's a JQuery Object)
// And the anchor link
[..]
});