Javascript Reference - HTML DOM Style unicodeBidi Property








The unicodeBidi property gets and sets the direction property.

Browser Support

unicodeBidi Yes Yes Yes Yes Yes

Syntax

Return the unicodeBidi property:

var v = object.style.unicodeBidi 

Set the unicodeBidi property:

object.style.unicodeBidi='normal|embed|bidi-override|initial|inherit'

Property Values

normal
offers no additional levels of embedded bi-directional text. This is the the default browser behavior. An element with this property will only contain LTR or RTL text.
embed
Creates an additional level of embedding. For example, RTL text flowing amidst LTR text.
bidi-override
Creates an additional level of embedding. Reordering depends on the direction property. Acts the same as embed when applied to inline elements. For block-level elements, it overrides the browser's bi-directional text algorithm and flows the text inside any inline children direction property.

Technical Details

Default Value: normal 
Return Value: A string representing unicode-bidi property
CSS Version CSS2




Example

The following code shows how to override text in a <p> element.


<!DOCTYPE html>
<html>
<body>
<!--from  w w  w  . ja v a  2  s.  c  o  m-->
<p>This is a paragraph.</p>
<p id="myP" style="direction:rtl">This is another paragraph.</p>
<button type="button" onclick="myFunction()">test</button>
<script>
function myFunction() {
    document.getElementById("myP").style.unicodeBidi = "bidi-override";
}
</script>

</body>
</html>

The code above is rendered as follows:





Example 2

The following code shows how to get the unicodeBidi property.


<!DOCTYPE html>
<html>
<body>
<!--from ww w . j a va  2s . c om-->
<p>This is a paragraph.</p>
<p id="myP" style="direction:rtl;unicode-bidi:bidi-override;">This is another paragraph.</p>
<button type="button" onclick="myFunction()">test</button>
<script>
function myFunction() {
    console.log(document.getElementById("myP").style.unicodeBidi);
}
</script>
</body>
</html>

The code above is rendered as follows: