Move jQuery function inside the scope.