标签: jquery
我发现有时这段代码会返回NotFoundError: An attempt was made to reference a Node in a context where it does not exist.
NotFoundError: An attempt was made to reference a Node in a context where it does not exist.
$('a').replaceWith(function() { return $.text([this]); });
当锚没有任何文本节点时,是否抱怨一个案例?也许是一个子HTML元素?
答案 0 :(得分:6)
试试这个:
$('a').contents().unwrap()
的 DEMO 强>