I wanted to know if it's possible to add HTML tags to JavaScript alert() method, such as:
alert()
<b> <ul> <li>
etc.
Thanks for your help
You can use all Unicode characters and the escape characters and . An example:
document.getElementById("test").onclick = function() { alert( 'This is an alert with basic formatting ' + "? list item 1 " + '? list item 2 ' + '? list item 3 ' + '??????????????????????? ' + 'Simple table ' + 'Char| Result ' + '\n| line break ' + '\t| tab space' ); }
<!DOCTYPE html> <title>Alert formatting</title> <meta charset=utf-8> <button id=test>Click</button>
1.4m articles
1.4m replys
5 comments
57.0k users