Ok. So, if I understand correctly, your Javascript/jQuery code does not work when you convert the existing working code into a user control, right?
If so, it might be because of bad reference. JavaScript files might not be at the location you define in your usercontrol.
2 options:
1. Correct the relative URL to point at correct location
2. Specify an absolute path.
Option 1 is what is suggested and generally preferred. For it, I would suggest you to use this Tip and resolve the path correctly before setting the source of the file:
Resolving Paths in a Multi-Folder WebSite[
^]