Link to home
Start Free TrialLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

Triple line in an alert message

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>
ASKER CERTIFIED SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Whing Dela Cruz

ASKER

It's working thank you, Lee Savidge!
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
Thank you Julian, I've got it!