---
title: "How to get the clicked menu details"  
description: "How to get the clicked menu details"  
author: "Anonymous User"  
published: 2015-01-20  
updated: 2015-01-20  
canonical: https://www.mindstick.com/forum/12879/how-to-get-the-clicked-menu-details  
category: "javascript"  
tags: ["asp.net", "jquery", "css"]  
reading_time: 1 minute  

---

# How to get the clicked menu details

i have jquery menu like

```
<ul id="fileMenu">    <li>Refresh</li>    <li>-</li>    <li>Exit</li></ul><ul  id="editMenu">    <li>Add</li>    <li>Edit</li>    <li>Delete</li></ul>
```

i got the way to get [click event](https://www.mindstick.com/forum/424/how-to-call-form_paint-event-on-button-click-event) on child menu [items](https://www.mindstick.com/forum/33812/getting-number-of-items-selected-in-uicollectionview-in-ios) like

```
  $('#fileMenu').on('click', 'li', function () {            alert("Hello"); // Or make($(this)); if you still want that extra function        });
```

But, how to find out the particular menu [option](https://www.mindstick.com/forum/159391/jquery-get-selected-option-from-dropdown), [i.e](https://answers.mindstick.com/qa/39877/what-state-was-the-first-to-enter-the-union-i-e-was-the-first-to-ratify-the-united-states-constitution) [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) clicked on Open, Exit, Edit, [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) etc...

## Replies

### Reply by Pravesh Singh

Use clicked element context this to create jquery selector along with .text() to get the text in it.

You will also need to add other parent ul selector(like #editMenu) to target their elements as well :

```
$('#fileMenu,#editMenu').on('click', 'li', function () {        var currenttext=$(this).text();        alert(currenttext);
        if(currenttext=="Add"){            //perform Add        }else if(currenttext=="Delete"){            //perform delete        }else{            //perform edit         }        });
```


---

Original Source: https://www.mindstick.com/forum/12879/how-to-get-the-clicked-menu-details

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
