We help IT Professionals succeed at work.

Triple line in an alert message

Whing Dela Cruz
on
126 Views
Last Modified: 2017-04-06
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

CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

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

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!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions