Skip to content Skip to sidebar Skip to footer

Rtl Confirm And Alert In Javascript

Can you make a confirm or alert show its message RTL and right-aligned?

Solution 1:

Programmatically no, but the user's culture setting for their machine should determine which way it's presented, at least in all current browsers. I'm not aware of a comprehensive "who supports it" list though.

Solution 2:

Try adding this at the beginning of your message: "\u200f\u200f"

for example:

alert("\u200f\u200f"+ message);

or

confirm("\u200f\u200f"+ message);

Solution 3:

If you have control over the <html>tag, set direction to RTL like this <html dir="rtl">

You may also do it with javascript as shown below:

document.getElementsByTagName("html")[0].setAttribute("dir","rtl");

Post a Comment for "Rtl Confirm And Alert In Javascript"