after a call with Axios, I want to replace the current item with a new one. I proceed like this:
var replacedElement = "<span class='float-right' aria-hidden='true'>" +
"<i class='fas fa-check icon-color'></i>" +
"</span>";
axios.post(url).then(function (response) {
$(this).replaceWith($.parseHTML(replacedElement));
});
But I have the following error : Uncaught (in promise) TypeError: Cannot read property 'createDocumentFragment' of undefined
My $(this)
references a span
element :
So I don't understand why I have this error