Text formatting in JS alerts | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Text formatting in JS alerts

How can I print a value (defined by Users input) in an alert strong, italic and red?

4th Mar 2017, 3:41 PM
Phoenix24
2 Answers
0
You should be able to don't forget you can add "<h1>" and "<p>" tags.
4th Mar 2017, 5:08 PM
Edidiong Udoh
Edidiong Udoh - avatar
0
but this is not working. What should I change, if I want to print the Users name bold and italic? alert ("Hello " + document.getElementById('username').value +"!")
4th Mar 2017, 5:24 PM
Phoenix24