JSFiddle - React, Tailwind, and code Playground
by Brian Layman
HTML
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<div class="post">
<p class="frontlabel">
This is the front label for post 1
</p>
<p class="backlabel">
This is the back label for post 1
</p>
</div>
<div class="break">
</div>
<div class="post">
<p class="frontlabel">
This is the front label for post 2
</p>
<p class="backlabel myelem">
This is the back label for post 2
</p>
</div>
<div class="break">
</div>
<div class="post">
<p class="frontlabel">
This is the front label for post 3
</p>
<p class="backlabel">
This is the back label for post 3
</p>
</div>
<div class="break">
</div>
<div class="post">
<p class="frontlabel">
This is the front label for post 4
</p>
<p class="backlabel">
This is the back label for post 4
</p>
</div>
<div class="break">
</div>
<div class="post">
<p class="frontlabel">
This is the front label for post 5
</p>
<p class="backlabel">
This is the back label for post 5
</p>
</div>
<div class="break">
</div>
</body>
CSS
.post {
background: yellow;
}
.break {
height: 10px;
background: white;
}
p {
margin: 0;
}
JavaScript
alert($(".myelem").next().length);