Undefined variable fix when jQuery is being used