Solving "$ is not a function"