开发者

Disable click link functionality and mask out a table row

开发者 https://www.devze.com 2023-01-25 08:49 出处:网络
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.

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&nbsp;Apple</a></th>
    <td>name</td>
    <td class="bcell">
        <span>0&nbsp;/&nbsp;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 .

0

精彩评论

暂无评论...
验证码 换一张
取 消