JSFiddle - React, Tailwind, and code Playground

by parakuso

HTML

<div class="wrap">
  <div class="hello">    xxxx  </div>
  <div class="child">    2222  </div>
</div>

<div class="wrap">
  <div class="hello">    yyyy  </div>
  <div class="child">    2222  </div>
</div>

<div class="wrap">
  <div class="hello">    uuuu  </div>
  <div class="child">    2222  </div>
</div>

CSS

.wrap {
  height: 100%;
  width: 100%;
  display: block;
}
.child2 {
  height: 100px;
  width: 100px;
  background: red;
  margin: 10px;
}
.hello {
  height: 100px;
  width: 100px;
  background: green;
}

JavaScript

$('.wrap').each(function () {

var
$this = $(this),
x = $this.text('.child2');

    alert(x);
    console.log(x);
});



$('.wrap').each(function () {

var
$this = $(this),
child2 = $this.find('.child2'),
hello = $this.find('.hello');

child2.append(hello);
    
});