It shall be an affirmative defense if the parent or legal guardian has initiated the jurisdiction of the juvenile court against the minor prior to the time that he violated section 24-21.