JSFiddle - React, Tailwind, and code Playground

by techiedelight

HTML

<div id="container">
  <label>Enter your name:</label>
  <input type="text">
</div>
<div id="submit">
  <button>Submit</button>
</div>

CSS

#container {
  background-color: lightgrey;
  padding: 5px;
}

button {
  padding: 3px;
  margin: 5px;
}

JavaScript

document.getElementById("submit").onclick = function() {
  var fragment = document.createDocumentFragment();
  fragment.appendChild(document.getElementById('submit'));
  document.getElementById('container').appendChild(fragment);
}