Tabbed CMS collection: Next button not working after adding custom code

Hoping someone can help.

I added code to prevent the screen loading from the top when you click on a different tab (this was only happening on the live site) and this is now resulted in the NEXT button on the other tabs to not work. Can someone please help with changes that need to be made to the code to prevent this? See image of the custom code.