I have the following statement:
alert("Testing 123\n\n Testing 231");
I wanted to add a '< hr >'-liked tag between both \n\n. Is there any method to make a line in between?
I have the following statement:
alert("Testing 123\n\n Testing 231");
You cannot add HTML
code into an alert box, unfortunately.
However, you could attempt to simulate one if you really want a horizontal line in there; something like this would do the trick:
alert("Testing 123\n________________________\n Testing 231");
I wouldn't really recommend this though because getting the _____
across the entire alert box wouldn't be practical to do, since the width of an alert box is relative to the particular browser, so there isn't really any uniformity.
No, you cannot add html tags in the browser alert function.
BUT you can do this IF you are using jQuery UI.
$("<div>Testing 123<br/><hr/><br/>Testing 231</div>").dialog();
\n Testing 231");` But HTML is not parsed in an alert box, if that's what you expect, so it's just the literal characters "
" of course. – rgthree Nov 26 '15 at 04:19