In alert() is it possible to format using HTML tags such as <h1> <pre>? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In alert() is it possible to format using HTML tags such as <h1> <pre>?

2nd Mar 2017, 6:41 PM
Rich zamani
Rich zamani - avatar
4 Answers
+ 6
with native alert() is not possible. you can try custom alerts with jqueryUI dialog, or bootstrap modals
2nd Mar 2017, 7:04 PM
Patricio López
Patricio López - avatar
+ 5
@Rich zamani wrote: "someone with more knowledge" :D More than @Chirag is quiet possible, but not obvious :P As @Patricio answered, you cannot. And you must use '\n' to force break lines, as '<br>' will be literally outputed ^^ He's right too in its suggestion, even if, in addition, you can also do custom alerts just using Html/Css/Js by yourself ( without frameworks and/or libraries )... depending of your needs/wishs and of your skills ( but basics Html outputs are not hard to handle with JS -- skill is important mainly to use advanced Css styling ;) ).
3rd Mar 2017, 11:14 AM
visph
visph - avatar
+ 4
Probably no but still you can try if that happens
2nd Mar 2017, 6:42 PM
Chirag Bhansali
Chirag Bhansali - avatar
0
I tried but I did not work for me. I was thinking someone with more knowledge help out
2nd Mar 2017, 6:52 PM
Rich zamani
Rich zamani - avatar