Wrap jQuery scripting in anonymous function