I'm trying to implement functionality which when a link is clicked the correspondin开发者_开发知识库g anchor table row is effectively blanked out and the link disabled.
Is this possible using jQuery?
An example of one of the table rows would be:-
<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>
So if the anchor is clicked, the row will be blanked out.
This snippet will be self-explaining:
$(".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
[..]
});
You can try
.show() hide();
or
using .html() or .text()
replace the content itself
or
addClass and removeClass or add()
for adding css.
What ever you wish .
精彩评论