Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colour of Text in a Javascript Alert

Is there any way to change style of text, format the text inside a Javascript Alert box. e.g. changing its colour, making it bold, etc.?

Also, if there an Alert avalaible with a 'Yes', 'No' button instead of an 'OK'/'Cancel' one?

like image 569
M.N Avatar asked Dec 24 '08 09:12

M.N


2 Answers

No, I'm afraid that is not possible.

With JavaScript, you are limited to only 3 popup boxes: alert, prompt and confirm.

If you want to make a more featured popup, you should try using one of the many that exist written in JavaScript, which are built from JavaScript Libraries, such as this

like image 58
Andreas Grech Avatar answered Oct 07 '22 12:10

Andreas Grech


The best you can do for formatting is the new line character \n.

like image 23
alex Avatar answered Oct 07 '22 11:10

alex