What is this? That’s just reassigning it to a different name.
And why $ prefix? Why no const / let statements?
You need to study more .
Also, start using strict mode by adding 'use strict'; on top of each of your javascript file. Or even better, use modules which uses strict mode by default and allows you to split code into multiple files.