The unicodeBidi
property gets and sets the
direction property.
unicodeBidi |
Yes | Yes | Yes | Yes | Yes |
Return the unicodeBidi property:
var v = object.style.unicodeBidi
Set the unicodeBidi property:
object.style.unicodeBidi='normal|embed|bidi-override|initial|inherit'
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.
Default Value: | normal |
---|---|
Return Value: | A string representing unicode-bidi property |
CSS Version | CSS2 |
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:
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: