Remove jQuery ready() when not needed. Fixes #5255