JSFiddle - React, Tailwind, and code Playground
HTML
<div class="posts">
<div class="post" data-id="5"></div>
<div class="post" data-id="3"></div>
<div class="post" data-id="1"></div>
<div class="post" data-id="4"></div>
</div>
JavaScript
var max = Math.max.apply(Math, $(".posts .post").map(function () {
return $(this).data("id");
}));
alert(max);