Use ready function instead of onclick function