How to get all index of dynamic div in click button show more jquery

Solution:

I made a function for getting the index from a DOM element from a set of elements of the same class. I wasn’t quite sure what you were doing with the data-id attribute so I left it alone.

function get_index(list,item){
    for (l in list)
  {
    if(list[l] === item){
        return l;
    }
  }
  return -1;
}
$(document).ready(function(){
 $(".show-more").click(function(){   
    let index = get_index($(".show-more"),this);
  console.log(index);
 });
});