IE:对象不支持 属性 或方法 'closest'
IE: Object doesn't support property or method 'closest'
我在 IE 中遇到 "Object doesn't support property or method 'closest'" 错误。我正在使用 MooTools。谁能帮帮我..
var li = $$('.list')[0].clone(true, true);
var NewContainer = li.getElement('div.tile');
NewContainer.removeProperty('style');
NewContainer.set('id', 'container_'+catId);
NewContainer.closest('li').set('id', 'list_'+countID);
MooTools 没有 closest
。您可能想要 getParent
(它接受用于查找祖先的选择器),但与 jQuery 的 closest
不同,它不查看当前元素(我不认为那是这里有一个问题。
但请注意,您已经在变量 li
中引用了 NewContainer
的 li
父级。
我在 IE 中遇到 "Object doesn't support property or method 'closest'" 错误。我正在使用 MooTools。谁能帮帮我..
var li = $$('.list')[0].clone(true, true);
var NewContainer = li.getElement('div.tile');
NewContainer.removeProperty('style');
NewContainer.set('id', 'container_'+catId);
NewContainer.closest('li').set('id', 'list_'+countID);
MooTools 没有 closest
。您可能想要 getParent
(它接受用于查找祖先的选择器),但与 jQuery 的 closest
不同,它不查看当前元素(我不认为那是这里有一个问题。
但请注意,您已经在变量 li
中引用了 NewContainer
的 li
父级。