This function has inconsistent return values. This is the only place it returns anything, the rest of the time it will implicitly return undefined. I don't know much about jQuery plugins, but usually this is not what you want, and if so, you should put an explicit return null or undefined at the end.