Get the string representation of a DOM node

前端 未结 11 2125
傲寒
傲寒 2020-12-01 03:56

Javascript: I have the DOM representation of a node (element or document) and I\'m looking for the string representation of it. E.g.,

var el = document.creat         


        
11条回答
  •  遥遥无期
    2020-12-01 04:53

    if using react:

    const html = ReactDOM.findDOMNode(document.getElementsByTagName('html')[0]).outerHTML;
    

提交回复
热议问题