S
S
Shimpanze2018-02-05 11:43:50
JavaScript
Shimpanze, 2018-02-05 11:43:50

JavaScript: Why does replaceWith() return a string and not HTML?

Good afternoon!
Why, in this case, does replaceWith() return a string (HTML entities) and not HTML?

document.querySelectorAll('.entry-content em').forEach(function(entry) {
  entry.replaceWith(entry.outerHTML);
  // возвращает: <em>Hello!</em>
  // а нужно: <em>Hello!</em>
});

How to force to return the working HTML code, in this particular case?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question