Change menu item background color with javascript

3 posts, 0 answers
  1. Mike
    Mike avatar
    23 posts
    Member since:
    Jul 2008

    Posted 28 Jun 2010 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Jun 2010 Link to this post

    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.
  3. Mike
    Mike avatar
    23 posts
    Member since:
    Jul 2008

    Posted 29 Jun 2010 Link to this post

    Thanks for the fast reply Shinu, this worked great! 
Back to Top