Use .ready() and eventObject.