【发布时间】:2018-10-11 04:32:41
【问题描述】:
我需要从以下 html 中删除 [href]:
<span class="fl-post-info-author">
<a href="/author/name/“>Author Name</a>
</span>
$('span.fl-post-info-author a').removeAttr("href");
我已经尝试过了,但不确定如何定位 href。我正在尝试完全禁用链接,并希望文本保留,而不是链接。这是 WordPress 中的帖子元链接。
【问题讨论】:
-
这行得通。但是在加载之后或在这个 html 部分之后运行。更高效的是
$('.fl-post-info-author').find('a').removeAttr("href"); -
怎样更有效率?
标签: href