Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery.wrap()的HierarchyRequestError_Javascript_Jquery - Fatal编程技术网

Javascript jquery.wrap()的HierarchyRequestError

Javascript jquery.wrap()的HierarchyRequestError,javascript,jquery,Javascript,Jquery,我无法理解为什么我在chrome中出现这个错误: Uncaught HierarchyRequestError: Failed to execute 'replaceChild' on 'Node': The new child element contains the parent. 在firefox中也一样: HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy 这是

我无法理解为什么我在chrome中出现这个错误:

Uncaught HierarchyRequestError: Failed to execute 'replaceChild' on 'Node': The new child element contains the parent. 
在firefox中也一样:

HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy
这是我的js:

// Applies wrapper to lists
$('#content .portlet-body').find('ul').each(function() {
    var content = $(this);
    if ( !content.hasClass('dropdown-menu') && !content.hasClass('nav') && !content.hasClass('lfr-discussion-actions') && !content.hasClass('tree-view-content') ) {
        content.wrap('<div class="floating-list"></div>');
    }
});
//将包装器应用于列表
$('#content.portlet body').find('ul').each(function(){
var content=$(此值);
如果(!content.hasClass('dropdown-menu')&&&!content.hasClass('nav')&!content.hasClass('lfr-discussion-actions')&&&!content.hasClass('tree-view-content')){
content.wrap(“”);
}
});
这段代码的目的是在具有特殊类的包装器div之间包装特定的
ul
列表。有什么想法吗


谢谢

无法复制;代码在这里运行良好:您确定这是引发错误的块吗?当我将代码放入注释中时,错误消失。所以我相信就是这样。我还有其他代码。但是没有使用任何
replace
、或
clone
wrap
功能。一些人使用了
appendTo
append
,但乍一看em并没有什么问题。