This is a migrated thread and some comments may be shown as answers.

[Solved] How can I cancel a menu event?

2 Answers 82 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ilia
Top achievements
Rank 1
Ilia asked on 28 Mar 2010, 06:59 PM
Hi,
How can I cancel an event from the menu?
I've trying this:
function onSelect(e) 
{ 
   agent = jQuery.browser; 
   if (agent.msie) { 
       e.cancelBubble = true; 
   } 
   e.stopPropagation(); 
   return false; 
} 
and the menu action it's not canceled.
I'm missing something?
Thank you,
Paul

2 Answers, 1 is accepted

Sort by
0
Ilia
Top achievements
Rank 1
answered on 28 Mar 2010, 08:08 PM
Hi,
found a solution
<% Html.Telerik() 
           .ScriptRegistrar() 
           .OnDocumentReady(() => 
                                  {%> 
                                    $("#idOfTheMenu a.t-link").click(function(event){ 
                                            event.preventDefault(); 
                                     }); 
                                  <%} 
                           ); %> 
Other ideas?
Paul
0
Ilia
Top achievements
Rank 1
answered on 22 Apr 2010, 09:48 PM
Hi,
The second solution I need is to cancel the event depending on some parameters. So:
<% Html.Telerik() 
           .ScriptRegistrar() 
           .OnDocumentReady(() => 
                                  {%> 
                                    $("#idOfTheMenu a.t-link").click(function(event){ 
                                            var cancel = onSelect_check($(event.srcElement.parentElement)); 
                                            if(cancel) 
                                                event.preventDefault(); 
                                     }); 
                                  <%} 
                           ); %> 
I stopped using onSelect event of the menu and I used an onSelect replacement here.
Regards,
Paul
Tags
Menu
Asked by
Ilia
Top achievements
Rank 1
Answers by
Ilia
Top achievements
Rank 1
Share this question
or