I am working on a project where I need to display images from various users and want them to appear in different positions. Here is the code I am currently using:
@foreach($users as $user)
<div class="col-md-2 text-center" id="fighter">
<img src="{{$user->char_image}}">
</div>
@endforeach
var fighter = document.getElementById('fighter');
fighter.setAttribute("style", "margin-top:" + Math.floor(Math.random() * 100) + "px;");
The issue I am facing is that the margin changes only for the first div.