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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

124261 May 27,2016 08:41 AM UTC Jun 2,2016 05:16 AM UTC ASP.NET Web Forms 3
loading
Tags: Menu
kalum
Asked On May 27, 2016 08:41 AM UTC

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.
Thanks.

Dhivyalakshmi Thirumurugan [Syncfusion]
Replied On 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">   
            <Items>   
                <ej:MenuItem Id="Products" Text="Products"></ej:MenuItem>   
                <ej:MenuItem Id="Support" Text="Support"></ej:MenuItem>   
                <ej:MenuItem Id="Purchase" Text="Purchase"></ej:MenuItem>   
                   
            </Items>   
</ej:Menu>   
  
   
In Script side, please do the following.   
  
  
<script>   
        function onCreate(sender) {   
            console.log(sender.text + " " +  "is clicked");   
        }   
 </script>   
  
   
We have created a sample for your requirement.   
Please refer the below sample link:  
  
Please let us know, if you need any further assistance.    
  
Regards,   
Dhivyalakshmi.   


kalum
Replied On June 1, 2016 11:38 AM UTC

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

Kasithangam C [Syncfusion]
Replied On 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. 
 
Regards, 
Kasithangam 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;