EBAG
EBAG

Reputation: 22591

RTL Confirm and Alert in Javascript

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

Upvotes: 3

Views: 2368

Answers (3)

gopalraju
gopalraju

Reputation: 2309

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

Upvotes: 0

iair007
iair007

Reputation: 92

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

for example:

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

or

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

Upvotes: 7

Nick Craver
Nick Craver

Reputation: 630579

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.

Upvotes: 5

Related Questions