We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to get the text or Id of clicked menu item, on clientclick event in javascript?

I need to get the text or ID of the menu item where i clicked. How do i do it with javascript on clientclick event. Please help.

3 Replies

DT Dhivyalakshmi Thirumurugan Syncfusion Team May 30, 2016 10:52 AM UTC

Hi kalum,   
Thanks for contacting Syncfusion support.   
We can get the text of the clicked menu item using ClientSideOnClick event. Please check the below code.   
<ej:Menu ID="Menu1" runat="server"  ClientSideOnClick="onCreate">   
                <ej:MenuItem Id="Products" Text="Products"></ej:MenuItem>   
                <ej:MenuItem Id="Support" Text="Support"></ej:MenuItem>   
                <ej:MenuItem Id="Purchase" Text="Purchase"></ej:MenuItem>   
In Script side, please do the following.   
        function onCreate(sender) {   
            console.log(sender.text + " " +  "is clicked");   
We have created a sample for your requirement.   
Please refer the below sample link:  
Please let us know, if you need any further assistance.    

KA kalum June 1, 2016 11:38 AM UTC

Problem sorted out with the help of your sample. Thank you very much.

KC Kasithangam C Syncfusion Team June 2, 2016 05:16 AM UTC

Hi Kalum, 
Thanks for your update. Please get back to us if you have further queries. We will be happy to help you out. 

Live Chat Icon For mobile
Up arrow icon