使用jquery .wrap()的HierarchyRequestError

时间:2015-03-19 13:53:28

标签: 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

这是我的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>');
    }
});

这段代码的目的是在具有特殊类的包装器div之间包装特定的ul列表。有什么想法吗?

由于

0 个答案:

没有答案