RTL Confirm and Alert in Javascript

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

Answers:

Answer

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.

Answer

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

for example:

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

or

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

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");

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.