In several scenarios we would be required to execute a code at document load or a button click on the client side.