我有一个 rss-feed,其中每个帖子都以段落中包含的链接结尾。我想把它删除。
示例:
<p>I want to keep this</p>
<p>I want to <strong>find</strong> and <a href="#">remove</a> this string</p>
最佳答案
那么,删除最后一段可以这样完成:
$(document).ready(function () {
$('p:last').remove();
});
如果 RSS 新闻站点有自己的类,例如 class="RssRow"
,您可以使用 each()
删除每行的最后一个子元素:
$('.RssRow').each(function() {
$(this).find('p:last').remove();
});
关于php - 查找并删除 div 中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5212146/