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>
<button onclick="iGo()">Try</button>

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

Avatar of Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
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


It's working thank you, Lee Savidge!
Referring back to your other question

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!