javascript - Display all div attached to category in block when click button show more in jquery dynamically

one text

Solution:

You need to change div structure

<?php
if ($custom_term->count > 2) {
 echo "<div class='show-more'>Show more</div>";
}
echo '<div class="cat-group" style="display:none">
for($current_category as $id)
{
    echo '<div id="cat-name" data-id="'.$id.'" style="display:none">category name</div>';
}
</div>';
?>
<script>
$(".show-more").click(function(){
$(".cat-group").each(function(){
  $(".cat-name").show();
});
});
</script>

Source