setting css properties with hyphens on the fly

well it has nothing to do with dojo but I don't bother to create another tag, so I keep using it.

 

when dealing with setting css properties on the fly we may come across some names with hyphens like

 

z-index, background-color and etc.

 

unfortunately, when trying to set a new value by domstyle.set(xx, 'z-index', '10');

 

you may notice it doesn't work. 

 

the correct way is to use camel case like:

 

domstyle.set(xx, 'zIndex', '10').

 

 

你可能感兴趣的:(properties)