Waiting for DOM to be ready before executing code