Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
281
How to add javascript attribute?
posted

Dears,

 I want to execute some javascript code when I click on my UltraWebMenu item. How do I register the javascript on runtime.

Can I do like this:  MyMenu.Attribute.Add("onClick","MyFunction();");  I have done this in the page load event but does not work. Please show me the correct way to add script attribute so that when I click on the item it will execute the javascript function.

 

Thanks 

  • 10880
    Verified Answer
    posted

    Try this:

    igmenu_getMenuById('UltraWebMenu1').Events["ItemClick"][0]="UltraWebMenu1_ItemClick";

    where UltraWebMenu is the client id of the menu and UltraWebMenu1_ItemClick is the function name.