JSFiddle - React, Tailwind, and code Playground
HTML
Click on each of the items below to see effect:
<div class='comment' style='width:100px;height:20px;'>
<input type='hidden' class='post_id' value='1'/>
<div>DIV1</div>
</div>
<div class='comment' style='width:100px;height:20px;'>
<input type='hidden' class='post_id' value='2' />
DIV2
</div>
<div class='comment' style='width:100px;height:20px;'>
<input type='hidden' class='post_id' value='3'/>
DIV3
</div>
JavaScript
$("div.comment").click(function(){
var clicked_post_id = $(this).find('input.post_id').val();
alert('clicked item is : ' + clicked_post_id);
});