Avatar of Whing Dela Cruz
Whing Dela Cruz
Flag 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>
HTMLJavaScript

Avatar of undefined
Last Comment
Whing Dela Cruz

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Lee

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Whing Dela Cruz

ASKER
It's working thank you, Lee Savidge!
Julian Hansen

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
Whing Dela Cruz

ASKER
Thank you Julian, I've got it!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck