IE8 cloneNode(true) 对象不支持此属性或方法



$('#attachment-deletion').cloneNode(true);

IE报告对象不支持此属性或方法

我该怎么做呢?cloneNode是我解决IE8不识别jquery的克隆方法的方法,它甚至没有抛出关于

的错误。

cloneNode是一个原生javascript方法,不能在jQuery对象上工作,你必须决定使用什么:

jQuery

$('#attachment-deletion').clone(true);

或纯JS

document.getElementById('attachment-deletion').cloneNode(true);

编辑:如果需要的话,你也可以将Plain JS与jQuery结合使用:

$('#attachment-deletion').get(0).cloneNode(true);
// or
$('#attachment-deletion')[0].cloneNode(true);

最新更新