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.
Unfortunately, activation email could not send to your email. Please try again.

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 04:41 AM Jun 2,2016 01:16 AM ASP.NET Web Forms 3
loading
Tags: Menu
kalum
Asked On May 27, 2016 04:41 AM

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 06:52 AM

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 07:38 AM

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

Kasithangam C [Syncfusion]
Replied On June 2, 2016 01:16 AM

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.

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.

;