I try to run the script for every @foreach loop like in the code below. But it seems the script only work only for the first loop. How to make it run for every loop ?