从jQuery对象中删除链接
我有一个关于jQuery的问题,我想从存储从jQuery对象中删除链接,jquery,html,Jquery,Html,我有一个关于jQuery的问题,我想从存储 $website.html().remove('a'); $website.html() returns = egg street eggland eg1 <a href="random"> <img src=""></img>
$website.html().remove('a');
$website.html() returns = egg street eggland eg1 <a href="random">
<img src=""></img>
</a>
但这似乎并没有消除任何东西
如果我完全做错了,你能给我指出正确的方向吗
谢谢
基本上用ing$website
查找所有锚定标记并将其删除
相反(根据OP下面的评论):
基本上,在
$website
中查找所有非锚定标记的内容并将其删除。@jondavidjohn:-p您知道您喜欢它^ ^或者,$website.find('a').remove()代码>,这就是上下文选择器在幕后运行的方式。有没有一种方法可以做相反的事情并返回不在alink内的内容?你说“返回不在alink内的内容”是什么意思?@sausageRolls-um他在问问题,而不是发表声明。查看我的更新。。。。
$website.remove('a');
$('a', $website).remove(); // P00F
$($website.children()).not('a').remove(); // P00F