Each event is not firing

Each event is not firing

I have included a jQuery file in my template, and it loads perfectly. But when I am trying to implement each function, it doesnt fire that event. I am writing some jQuery code for Salesforce Commerce Cloud SFRA. Whereas the same script works for other DOM elements on other platforms like JS Fiddle and Chrome Devtools.

This script is provided in a catridge by Paypal, so I just need to integrate the cartridge and it will work, but here I am having trouble because each event is not working.

Is there any thing that I can check for the same, if not, then is there any alternative method/event that can be replace each event?

Thanks in advance.