JSFiddle - React, Tailwind, and code Playground

by stevea

HTML

<div id='wrapper'>
    <div id='box1' class='active'>
           Box 1 text
  <!--      <div>'Some inner text'</div>  -->
    </div>
    <div id='box2' class='active'>Box 2 text</div>
</div><button id='getOuterHTML'>Get outerHTML</button>
<div id='contents'></div>

CSS

div#contents{
    width:600px;
    height:150px;
    border:1px solid black;
}

JavaScript

$(function(){ 
    var content='';
    $('#getOuterHTML').click(function() {
       $('.active').each(function(n) {
				content+=this.outerHTML;
				});
        $('#contents').text(content);

    });
});