# Retrieve an item in Menu Tree based on the menu clicked

**URL:** <https://forum.inductiveautomation.com/t/retrieve-an-item-in-menu-tree-based-on-the-menu-clicked/81805>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 13, 2023, 7:30am UTC](https://forum.inductiveautomation.com/t/retrieve-an-item-in-menu-tree-based-on-the-menu-clicked/81805 "2023-11-13T07:30:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MILLOGO\_Arthur](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@MILLOGO\_Arthur](https://forum.inductiveautomation.com/u/MILLOGO_Arthur)\
**Post date:** [November 13, 2023, 7:30am UTC](https://forum.inductiveautomation.com/t/retrieve-an-item-in-menu-tree-based-on-the-menu-clicked/81805/1 "2023-11-13T07:30:15Z")

</div>

I would like to ensure that every time I click on a menu in the menu tree component an icon appears on the menu and disappears on the next click. My problem is that in the configuration of the even (onItemClicked) script I don't know how to retrieve the items based on the menu clicked.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 13, 2023, 10:36am UTC](https://forum.inductiveautomation.com/t/retrieve-an-item-in-menu-tree-based-on-the-menu-clicked/81805/2 "2023-11-13T10:36:16Z")

</div>

Try using `event.path` in your script. It returns "A list containing the item indexes leading to the item that was clicked".  
The result will be in the form [1, 3] for the fourth item on the second level of the menu.

There are popup helpers for "self" and "event" on the Configure Script Action dialog windows which give some help.

---

<div class="post-metadata">

**Author:** ![MILLOGO\_Arthur](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@MILLOGO\_Arthur](https://forum.inductiveautomation.com/u/MILLOGO_Arthur)\
**Post date:** [November 13, 2023, 11:53am UTC](https://forum.inductiveautomation.com/t/retrieve-an-item-in-menu-tree-based-on-the-menu-clicked/81805/3 "2023-11-13T11:53:26Z")

</div>

Thanks, it works perfectly.

---

<div class="post-metadata">

**Author:** ![Emanuel\_Danielczyk](https://avatars.discourse-cdn.com/v4/letter/e/4da419/32.png) [@Emanuel\_Danielczyk](https://forum.inductiveautomation.com/u/Emanuel_Danielczyk)\
**Post date:** [April 22, 2024, 9:15am UTC](https://forum.inductiveautomation.com/t/retrieve-an-item-in-menu-tree-based-on-the-menu-clicked/81805/4 "2024-04-22T09:15:53Z")

</div>

Hello, can you show me the script that you wrote?
