What\'s the best way to detect the text direction of an html element using Javascript? I would expect to get either \"rtl\" or \"ltr\".
Try this
document.defaultView.getComputedStyle(document.getElementById('baz'),null)['direction'];
OR
style = document.defaultView.getComputedStyle(document.firstChild,null); console.log(style.direction);