If you use with C# then
\n will put a new line
alert("some text\nmore text in a new line");
more text in a new line
$text = "Example Text : \n" $text2 = "Example Text : \\n"
window.alert('<?php echo $text; ?>'); // not working window.alert('<?php echo $text2; ?>'); // is working