why code javascript ,not repeat the loop main wordpress

I think you used #id to set javascript action (event). Use .class in jQuery selector. Open console in your browser and see javascript errors.