如何删除< a href>使用Jquery链接特定值的标记 [英] How to Remove <a href> Link Tag for a Specific Value using Jquery

查看:130
本文介绍了如何删除< a href>使用Jquery链接特定值的标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在报告中有以下情况,该报告包含以下< td> 元素。请注意,这可能是报告的倍数。

I have the following situation within a report that has the following <td> element. Please note that this can appear multiples times as it is a report.

我的问题是,当值为'N'时,使用jQuery,我想删除整个< a href>标记并且仅显示N的值,不在其下方的下划线,否则如果值为Y则保持原样。

My question is, when the value is ‘N’, using jQuery, I would like to remove the whole <a href> tag and just display the value of ‘N’ alone, without the underline below it, otherwise if the value is ‘Y’ then leave it as it is.

例如:

<td align="center" headers="MPA_CHANGED"><a href="http://www.mysite.com" class="my-mpa">Y</a></td>

<td align="center" headers="MPA_CHANGED">N</td>


推荐答案

$('a').filter(function(){
    return this.innerHTML === 'N';
}).replaceWith('N');

直播DEMO

这篇关于如何删除&lt; a href&gt;使用Jquery链接特定值的标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆