If you use with C# then \n
will put a new line
alert("some text\nmore text in a new line");
Output:
some text
more text in a new line
When you want to write in javascript alert from a php variable, you have to add an other “\” before “\n”. Instead the alert pop-up is not working.
$text = "Example Text : \n" $text2 = "Example Text : \\n"
window.alert('<?php echo $text; ?>'); // not working window.alert('<?php echo $text2; ?>'); // is working