'How use a rectangle shape when clicked hides and shows layers in Illustrator

Hi I am trying to make a form in illustrator that an option box is shown or not shown based on what is clicked. (ex. when Rectangle1 is clicked I want to show Option1) I have 4 layers (Option1,Option2,Option3, & Option4). How do i go about writing a script that will achieve this and how do i implement it into my illustrator file?

Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source