Triple line in an alert message

Whing Dela Cruz
Whing Dela Cruz used Ask the Experts™
on
Hi experts, How to correct codes below? I want to have 3 lines in an alert message. Thank you!

<!Doctype Html>
<Html>
<body>
<button onclick="iGo()">Try</button>
</body>

<script>
function iGo()
{
  var m = "Monkey";
  var e = "Eagle";
  alert(m <br/> + "eating" <br/> + e);
}
</script>

</Html>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
alert(m + "\neating\n" + e);

Open in new window

Author

Commented:
It's working thank you, Lee Savidge!
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Referring back to your other question https://www.experts-exchange.com/questions/29014384/Popup-write-two-lines.html

If the output is going to a destination that renders HTML (and the output is not in <pre></pre> tags) then use <br/> for line breaks.

For text based output (Alert, console, command line etc) use \n

Author

Commented:
Thank you Julian, I've got it!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial