Answer the question
In order to leave comments, you need to log in
How to convert HTML to string?
Hello.
I receive an element.
var container = document.getElementsByClassName('container')[0];
var container = document.getElementsByClassName('container')[0]; // '<div class="container">Something</div>'
Answer the question
In order to leave comments, you need to log in
var container = document.getElementsByClassName('container')[0];
console.log(container.outerHTML);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question