![](/img/trans.png)
[英]Object doesn’t support property or method ‘readAsBinaryString’ - IE11
[英]IE11: Object doesn't support property or method 'replaceWith'
我有一個簡單的函數,可以在動態加載模式時將模式移動到模式容器。 它適用於Edge,Chrome和Firefox。 但是,在IE11中,出現錯誤:“對象不支持屬性或方法'replaceWith'”。 我們的客戶需要IE11支持。
是什么導致錯誤?
function moveModals() {
$('#mainBody .modal').each(function () {
if ($("#modalsContainer>#" + this.id).exists())
$("#modalsContainer>#" + this.id)[0].replaceWith(this);
else
$(this).appendTo("#modalsContainer");
});
}
使用此代替:
$("#modalsContainer>#" + this.id).replaceWith(this);
這樣,您僅依賴jQuery(從您編寫的內容中省略[0]
)。 您編寫的方式是從原始HTML DOM對象調用replaceWith。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.