Put JavaScript code into document ready event.