How to change the color of a menu item?

I have a menu item “Refresh”. In some situations I want to show on users that “Refresh” should be pressed.

This can be done if I change:

- Text color

- Background color

- Image



Is it possible to change the color of a menu item with JavaScript?




The setItemImage(id, img, imgDis) allows to set new image for a item.


But there is no API to set style. You can try to use internal method as follows:


objMenu.idPull[objMenu.idPrefix+itemId].style.color = some_colour;


Where itemId is the id of the item

Goodmorning Alexandra…
I dont quite understand your explanation.

I have:
menu.addNewSibling(“men1”, “men2”, “Alarms”, false);

I would like to change the background color of this Item programmatically

I have tried:

menu.idPull[menu.idPrefix+men2].style.color = “red”

But it gives error

Please, refer to the following snippet demonstrating the logic:
http://snippet.dhtmlx.com/5/e4d01019a

1 Like