views:

40

answers:

1

Hi, I'm trying to get the direction property for the element. I have this code:

document.write('<div style="position: absolute; display: none;" id="menuDiv"></div>');

And in my .css file I have:

#menuDiv {
    direction: rtl;
}

Then, using prototype, I'm trying to query the direction for that div:

alert( $('menuDiv').style.direction );

But for some reason I'm always getting blank, never an 'rtl' value which I need to find out whether current style is left-to-right or not so that the menu can be positioned properly.

Thanks!

+1  A: 

Try using $('menuDiv').getStyle('direction'). The element's "style" property may not contain the style as applied by the stylesheet.

jvenema
Perfect :)Thank you!
Daniil