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

Change menu item background color with javascript

2 Answers 74 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 28 Jun 2010, 11:09 PM

Is there a way to change the background color of a menu item through javascript?  I've tried the adding the following code to the OnClientShowing event but it did not seem work:

 

 

 

 

var item = sender.get_items().getItem(1);

 

item.set_cssClass(

 

'blue_bkgd');

Thanks,

 

 

 

 

 

 

 

Mike

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Jun 2010, 06:40 AM
Hello Mike,

I am able to change the background-color by using following client code.

client code:
 
        var menu = $find("<%= RadMenu1.ClientID %>"); 
        var item = menu.findItemByValue('value1'); 
        item.get_element().style.backgroundColor = "red"

Hope this code will be beneficial for you.

Regards,
Shinu.
0
Mike
Top achievements
Rank 1
answered on 29 Jun 2010, 05:25 PM
Thanks for the fast reply Shinu, this worked great! 
Tags
Menu
Asked by
Mike
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Share this question
or