<div id="a">
  <div id="b"></div>
</div>

<button id="deco" type="button">Add decorate divs</button>

.decorate {
  background-color: green;
  color: #fff;
  padding: 15px;
}
$("#deco").click(function () {
  $("<div></div>").appendTo("div").addClass("decorate");
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js